Glib
view release on metacpan or search on metacpan
#if GLIB_CHECK_VERSION (2, 12, 0)
GPERL_CALL_BOOT (boot_Glib__BookmarkFile);
#endif /* GLIB_CHECK_VERSION (2, 12, 0) */
#if GLIB_CHECK_VERSION (2, 24, 0)
GPERL_CALL_BOOT (boot_Glib__Variant);
#endif /* GLIB_CHECK_VERSION (2, 24, 0) */
/* make sure that we're running/linked against a version at least as
* new as we built against, otherwise bad things will happen. */
if ((((int)glib_major_version) < GLIB_MAJOR_VERSION)
||
(glib_major_version == GLIB_MAJOR_VERSION &&
((int)glib_minor_version) < GLIB_MINOR_VERSION)
||
(glib_major_version == GLIB_MAJOR_VERSION &&
glib_minor_version == GLIB_MINOR_VERSION &&
((int)glib_micro_version) < GLIB_MICRO_VERSION))
warn ("*** This build of Glib was compiled with glib %d.%d.%d,"
" but is currently running with %d.%d.%d, which is too"
" old. We'll continue, but expect problems!\n",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION,
glib_major_version, glib_minor_version, glib_micro_version);
##
## NOTE: in order to avoid overwriting the docs for the main Glib.pm,
## all xsubs in this section must be either assigned to other
## packages or marked as hidden.
##
=for apidoc __hide__
=cut
const char *
filename_from_unicode (class_or_filename, filename=NULL)
GPerlFilename_const class_or_filename
GPerlFilename_const filename
PROTOTYPE: $
CODE:
RETVAL = items < 2 ? class_or_filename : filename;
OUTPUT:
RETVAL
=for apidoc __hide__
=cut
GPerlFilename_const
filename_to_unicode (const char * class_or_filename, const char *filename=NULL)
PROTOTYPE: $
CODE:
RETVAL = items < 2 ? class_or_filename : filename;
OUTPUT:
RETVAL
=for apidoc __hide__
=cut
void
filename_from_uri (...)
PROTOTYPE: $
PREINIT:
gchar * filename = NULL;
const char * uri;
char * hostname = NULL;
GError * error = NULL;
PPCODE:
/* support multiple call syntaxes. */
uri = items < 2 ? SvPVutf8_nolen (ST (0)) : SvPVutf8_nolen (ST (1));
filename = g_filename_from_uri (uri,
GIMME_V == G_ARRAY ? &hostname : NULL,
&error);
if (!filename)
gperl_croak_gerror (NULL, error);
PUSHs (sv_2mortal (newSVpv (filename, 0)));
if (GIMME_V == G_ARRAY && hostname) {
/* The g_filename_from_uri() docs say hostname is utf8,
* hence newSVGChar, though as of glib circa 2.16
* hostname_validate() only actually allows ascii
* alphanumerics, so utf8 doesn't actually come out.
*/
XPUSHs (sv_2mortal (newSVGChar (hostname)));
}
g_free (filename);
if (hostname) g_free (hostname);
=for apidoc __hide__
=cut
gchar_own *
filename_to_uri (...)
PROTOTYPE: $$
PREINIT:
char * filename = NULL;
char * hostname = NULL;
GError * error = NULL;
CODE:
/* The g_filename_to_uri() docs say hostname is utf8, hence SvGChar,
* though as of glib circa 2.16 hostname_validate() only actually
* allows ascii alphanumerics, so you can't in fact pass in utf8.
*/
if (items == 2) {
filename = SvPV_nolen (ST (0));
hostname = gperl_sv_is_defined (ST (1)) ? SvGChar (ST (1)) : NULL;
} else if (items == 3) {
filename = SvPV_nolen (ST (1));
hostname = gperl_sv_is_defined (ST (2)) ? SvGChar (ST (2)) : NULL;
} else {
croak ("Usage: Glib::filename_to_uri (filename, hostname)\n"
" -or- Glib->filename_to_uri (filename, hostname)\n"
" wrong number of arguments");
}
RETVAL = g_filename_to_uri (filename, hostname, &error);
if (!RETVAL)
gperl_croak_gerror (NULL, error);
OUTPUT:
RETVAL
## XXX i'd prefer to have local fallbacks so that we don't need this version hack.
## unfortunately, these functions are nontrivial.
#if GLIB_CHECK_VERSION(2, 6, 0)
### note the use of raw const char* here.
# from gconvert.h. Pod is in Glib.pm.
=for apidoc __hide__
( run in 0.798 second using v1.01-cache-2.11-cpan-5511b514fd6 )