1 // A simple string class, a lot like GString but with full GObject
2 // machinery and really short method names for the lazy :)
8 class :Str from G:Object {
10 private GString *contents;
16 g_print ("%s", self->_priv->contents->str);
21 new (const char *format (check null), ...) attr {G_GNUC_PRINTF (1, 2)}
22 onerror NULL defreturn NULL
25 va_start (ap, format);
26 gchar *tmp = g_strdup_vprintf (format, ap);
29 Self *self = (Self *) GET_NEW;
31 self->_priv->contents = g_string_new (tmp);
35 return G_OBJECT (self);
38 // It seems gob accepts defreturn on non-virtual non-signal types
39 // without complaint, though from the man page I'm not sure the
40 // resulting behavior is well defined.
43 nonvirt_test (self, const char *format (check null), ...)
44 attr {G_GNUC_PRINTF (2,3)}
52 private_test_method (self, const char *format (check null), ...)
53 attr {G_GNUC_PRINTF (2, 3)}
61 private_method_caller (self)
63 int much_too_general = 42;
65 // This should trigger a warning.
66 self_private_test_method (self, "want a string: %s", much_too_general);
69 str_private_test_method (self, "want a string: %s", much_too_general);