]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
extend unicode support, add GRegex
authorJürg Billeter <j@bitron.ch>
Tue, 3 Apr 2007 11:16:58 +0000 (11:16 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 3 Apr 2007 11:16:58 +0000 (11:16 +0000)
2007-04-03  Jürg Billeter  <j@bitron.ch>

* vapi/glib-2.0.vala: extend unicode support, add GRegex

svn path=/trunk/; revision=270

vala/ChangeLog
vala/vapi/glib-2.0.vala

index 37078c41b64740c9f773900999b1c6e4595c4731..787b45ca0982a9086e72ffd754bf301719b2dcd5 100644 (file)
@@ -1,3 +1,7 @@
+2007-04-03  Jürg Billeter  <j@bitron.ch>
+
+       * vapi/glib-2.0.vala: extend unicode support, add GRegex
+
 2007-03-28  Raffaele Sandrini  <rasa@gmx.ch>
 
        * vapi/glib-2.0.vala: declare HashFunc and EqualFunc as callback
index 40afd1ae444f6613606cea308c7f0d1df256449b..dca3f7baa21dd135868d133051cda2a7c076bccd 100644 (file)
@@ -312,32 +312,111 @@ public struct double {
        public ref string! to_string (string! format = "%g");
 }
 
-[CCode (cname = "gunichar", cheader_filename = "glib.h", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0U")]
+[CCode (cname = "gunichar", cprefix = "g_unichar_", cheader_filename = "glib.h", get_value_function = "g_value_get_int", set_value_function = "g_value_set_int", default_value = "0U")]
 [IntegerType (rank = 13)]
 public struct unichar {
-       [CCode (cname = "g_unichar_isalnum")]
+       public bool validate ();
        public bool isalnum ();
-       [CCode (cname = "g_unichar_isdigit")]
+       public bool isalpha ();
+       public bool iscntrl ();
        public bool isdigit ();
-       [CCode (cname = "g_unichar_isspace")]
+       public bool isgraph ();
+       public bool islower ();
+       public bool isprint ();
+       public bool ispunct ();
        public bool isspace ();
-       [CCode (cname = "g_unichar_isupper")]
        public bool isupper ();
-       [CCode (cname = "g_unichar_isxdigit")]
        public bool isxdigit ();
-       [CCode (cname = "g_unichar_toupper")]
+       public bool istitle ();
+       public bool isdefined ();
+       public bool iswide ();
+       public bool iswide_cjk ();
+       public bool iszerowidth ();
        public unichar toupper ();
-       [CCode (cname = "g_unichar_tolower")]
        public unichar tolower ();
-       [CCode (cname = "g_unichar_digit_value")]
+       public unichar totitle ();
        public int digit_value ();
-       [CCode (cname = "g_unichar_xdigit_value")]
        public int xdigit_value ();
-       
-       [CCode (cname = "g_unichar_to_utf8")]
+       public UnicodeType type ();
+       public UnicodeBreakType break_type ();
+
        public int to_utf8 (string outbuf);
 }
 
+[CCode (cprefix = "G_UNICODE_")]
+public enum UnicodeType {
+       CONTROL,
+       FORMAT,
+       UNASSIGNED,
+       PRIVATE_USE,
+       SURROGATE,
+       LOWERCASE_LETTER,
+       MODIFIER_LETTER,
+       OTHER_LETTER,
+       TITLECASE_LETTER,
+       UPPERCASE_LETTER,
+       COMBINING_MARK,
+       ENCLOSING_MARK,
+       NON_SPACING_MARK,
+       DECIMAL_NUMBER,
+       LETTER_NUMBER,
+       OTHER_NUMBER,
+       CONNECT_PUNCTUATION,
+       DASH_PUNCTUATION,
+       CLOSE_PUNCTUATION,
+       FINAL_PUNCTUATION,
+       INITIAL_PUNCTUATION,
+       OTHER_PUNCTUATION,
+       OPEN_PUNCTUATION,
+       CURRENCY_SYMBOL,
+       MODIFIER_SYMBOL,
+       MATH_SYMBOL,
+       OTHER_SYMBOL,
+       LINE_SEPARATOR,
+       PARAGRAPH_SEPARATOR,
+       SPACE_SEPARATOR
+}
+
+[CCode (cprefix = "G_UNICODE_BREAK_")]
+public enum UnicodeBreakType {
+       MANDATORY,
+       CARRIAGE_RETURN,
+       LINE_FEED,
+       COMBINING_MARK,
+       SURROGATE,
+       ZERO_WIDTH_SPACE,
+       INSEPARABLE,
+       NON_BREAKING_GLUE,
+       CONTINGENT,
+       SPACE,
+       AFTER,
+       BEFORE,
+       BEFORE_AND_AFTER,
+       HYPHEN,
+       NON_STARTER,
+       OPEN_PUNCTUATION,
+       CLOSE_PUNCTUATION,
+       QUOTATION,
+       EXCLAMATION,
+       IDEOGRAPHIC,
+       NUMERIC,
+       INFIX_SEPARATOR,
+       SYMBOL,
+       ALPHABETIC,
+       PREFIX,
+       POSTFIX,
+       COMPLEX_CONTEXT,
+       AMBIGUOUS,
+       UNKNOWN,
+       NEXT_LINE,
+       WORD_JOINER,
+       HANGUL_L_JAMO,
+       HANGUL_V_JAMO,
+       HANGUL_T_JAMO,
+       HANGUL_LV_SYLLABLE,
+       HANGUL_LVT_SYLLABLE
+}
+
 [ReferenceType (dup_function = "g_strdup", free_function = "g_free", type_id = "G_TYPE_STRING")]
 [CCode (cname = "char", const_cname = "const char", cheader_filename = "stdlib.h,string.h,glib.h", type_id = "G_TYPE_STRING", marshaller_type_name = "STRING", get_value_function = "g_value_get_string", set_value_function = "g_value_set_string")]
 public struct string {
@@ -359,11 +438,16 @@ public struct string {
        public ref string[] split (string! delimiter, int max_tokens = 0);
        [CCode (cname = "g_strsplit_set")]
        public ref string[] split_set (string! delimiters, int max_tokens = 0);
+       [CCode (cname = "g_strjoinv")]
+       [NoArrayLength]
+       public static string joinv (string! separator, string[] str_array);
        
        [CCode (cname = "g_utf8_next_char")]
        public weak string next_char ();
        [CCode (cname = "g_utf8_get_char")]
        public unichar get_char ();
+       [CCode (cname = "g_utf8_get_char_validated")]
+       public unichar get_char_validated (long max_len = -1);
        [CCode (cname = "g_utf8_offset_to_pointer")]
        [PlusOperator ()]
        public weak string offset (long offset);
@@ -375,6 +459,8 @@ public struct string {
        public long len (long max = -1);
        [CCode (cname = "g_utf8_strchr")]
        public weak string chr (long len, unichar c);
+       [CCode (cname = "g_utf8_strrchr")]
+       public weak string rchr (long len, unichar c);
        [CCode (cname = "g_utf8_strreverse")]
        public ref string! reverse (int len = -1);
        [CCode (cname = "g_utf8_validate")]
@@ -1153,7 +1239,48 @@ namespace GLib {
        [ReferenceType ()]
        public struct OptionGroup {
        }
-       
+
+       /* Perl-compatible regular expressions */
+
+       [CCode (cprefix = "G_REGEX_")]
+       public enum RegexCompileFlags {
+               CASELESS,
+               MULTILINE,
+               DOTALL,
+               EXTENDED,
+               ANCHORED,
+               DOLLAR_ENDONLY,
+               UNGREEDY,
+               RAW,
+               NO_AUTO_CAPTURE,
+               DUPNAMES,
+               NEWLINE_CR,
+               NEWLINE_LF,
+               NEWLINE_CRLF
+       }
+
+       [CCode (cprefix = "G_REGEX_MATCH_")]
+       public enum RegexMatchFlags {
+               ANCHORED,
+               NOTBOL,
+               NOTEOL,
+               NOTEMPTY,
+               PARTIAL,
+               NEWLINE_CR,
+               NEWLINE_LF,
+               NEWLINE_CRLF,
+               NEWLINE_ANY
+       }
+
+       [ReferenceType (free_function = "g_regex_free")]
+       public struct Regex {
+               public Regex (string! pattern, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0, out Error error = null);
+               public bool optimize (out Error error = null);
+               public static bool match_simple (string! pattern, string! string, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0);
+               public bool match (string! string, RegexMatchFlags match_options = 0);
+               public string fetch (int match_num, string! string);
+       }
+
        /* Simple XML Subset Parser */
        
        [CCode (cprefix = "G_MARKUP_")]