Web lists-archives.com

G_UTF8String: Boxed Type Proposal




I have a question at the end of this! Please answer if you think it will help.

The following is the result of my efforts to develop widgets derived from GtkEntry and GtkEntryBuffer. Specifically, I want to have the ability to easily develop entries which validate their content and which may have specified affixes - which may or may not be selectable.

Glib and Gtk employ UTF-8 strings. This requires that code be written which maintains awareness not only of lengths of strings in bytes - but also in numbers of unicode characters. For example, the private data in GtkEntryBuffer does this. Instead of re-inventing the wheel each time a new application is developed, it would be useful to have a string type - along the lines of GString - but which maintains a count of unicode characters. It's methods which take raw strings as arguments should also validate these as they are passed.

I propose the development of a new boxed type for the Glib API named "G_UTF8String". I have searched through this mailing list's archives to see if anyone else has proposed anything similar. I have not found any.

 I have already written the code for the following foundational prototypes:

g_utf8_string_get_type
g_utf8_string_new
g_utf8_string_copy
g_utf8_string_free
g_utf8_string_char_length
g_utf8_string_byte_length
g_utf8_string_fill
g_utf8_string_splice
g_utf8_string_clear
g_utf8_string_assign
g_utf8_string_prepend
g_utf8_string_append
g_utf8_string_insert
g_utf8_string_remove
g_utf8_string_substring
g_utf8_string_concat
g_utf8_string_get_char
g_utf8_string_set_char
g_utf8_string_fill_char
g_utf8_string_splice_char
g_utf8_string_assign_char
g_utf8_string_prepend_char
g_utf8_string_append_char
g_utf8_string_insert_char
g_utf8_string_fill_utf8
g_utf8_string_splice_utf8
g_utf8_string_assign_utf8
g_utf8_string_prepend_utf8
g_utf8_string_append_utf8
g_utf8_string_insert_utf8

The constructor and the methods ending in *_utf8 take raw string pointers as arguments. The functions ending in *_char each take a single gunichar. The remaining operate on pointers to allocated G_UTF8String structures. The *_(clear|assign|prepend|append|insert|remove)* methods are macros which call the respective *_splice* function. I find that this makes the source code easier to maintain. I also have in the works auxiliary types G_UTF8StringView - along the lines of a vector view as provided in GSL - and an iterator.

I would like to contribute to the Glib library by introducing the possibility of integrating this boxed type. I have not participated in this way before. What is the best way to proceed? Is it to participate on GitHub at GNOME/glib?

Thank you!


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list