/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.45 from the
 * contents of XMMSClientCollection.xs. Do not edit this file, edit XMMSClientCollection.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "../src/clients/lib/perl/XMMSClientCollection.xs"
#include "perl_xmmsclient.h"

#line 13 "../src/clients/lib/perl/XMMSClientCollection.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 157 "../src/clients/lib/perl/XMMSClientCollection.c"

XS_EUPXS(XS_Audio__XMMSClient__Collection_new); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_new)
{
    dVAR; dXSARGS;
    if (items < 2)
       croak_xs_usage(cv,  "class, type, ...");
    {
	xmmsv_coll_type_t	type;
#line 44 "../src/clients/lib/perl/XMMSClientCollection.xs"
		int i, nargs;
		HV *args;
		HE *iter;
#line 171 "../src/clients/lib/perl/XMMSClientCollection.c"
	xmmsv_t *	RETVAL;

	{
		char *coll_type = SvPV_nolen (ST(1));
		if (strcmp (coll_type, "reference") == 0) {
			type = XMMS_COLLECTION_TYPE_REFERENCE;
		}
		else if (strcmp (coll_type, "universe") == 0) {
			type = XMMS_COLLECTION_TYPE_UNIVERSE;
		}
		else if (strcmp (coll_type, "union") == 0) {
			type = XMMS_COLLECTION_TYPE_UNION;
		}
		else if (strcmp (coll_type, "intersection") == 0) {
			type = XMMS_COLLECTION_TYPE_INTERSECTION;
		}
		else if (strcmp (coll_type, "complement") == 0) {
			type = XMMS_COLLECTION_TYPE_COMPLEMENT;
		}
		else if (strcmp (coll_type, "has") == 0) {
			type = XMMS_COLLECTION_TYPE_HAS;
		}
		else if (strcmp (coll_type, "equals") == 0) {
			type = XMMS_COLLECTION_TYPE_EQUALS;
		}
		else if (strcmp (coll_type, "notequal") == 0) {
			type = XMMS_COLLECTION_TYPE_NOTEQUAL;
		}
		else if (strcmp (coll_type, "match") == 0) {
			type = XMMS_COLLECTION_TYPE_MATCH;
		}
		else if (strcmp (coll_type, "smaller") == 0) {
			type = XMMS_COLLECTION_TYPE_SMALLER;
		}
		else if (strcmp (coll_type, "smallereq") == 0) {
			type = XMMS_COLLECTION_TYPE_SMALLEREQ;
		}
		else if (strcmp (coll_type, "greater") == 0) {
			type = XMMS_COLLECTION_TYPE_GREATER;
		}
		else if (strcmp (coll_type, "greatereq") == 0) {
			type = XMMS_COLLECTION_TYPE_GREATEREQ;
		}
		else if (strcmp (coll_type, "order") == 0) {
			type = XMMS_COLLECTION_TYPE_ORDER;
		}
		else if (strcmp (coll_type, "limit") == 0) {
			type = XMMS_COLLECTION_TYPE_LIMIT;
		}
		else if (strcmp (coll_type, "mediaset") == 0) {
			type = XMMS_COLLECTION_TYPE_MEDIASET;
		}
		else if (strcmp (coll_type, "idlist") == 0) {
			type = XMMS_COLLECTION_TYPE_IDLIST;
		}
		else {
			croak ("unknown XMMSV_COLL_TYPE_T: %s", coll_type);
		}
	}
;
#line 48 "../src/clients/lib/perl/XMMSClientCollection.xs"
		RETVAL = xmmsv_new_coll (type);

		nargs = items - 2;
		if (nargs == 1) {
			if (!SvOK (ST (2)) || !SvROK (ST (2)) || !(SvTYPE (SvRV (ST (2))) == SVt_PVHV))
				croak ("expected hash reference or hash");

			args = (HV *)SvRV (ST (2));

			hv_iterinit (args);
			while ((iter = hv_iternext (args))) {
				xmmsv_coll_attribute_set_string (RETVAL, HePV (iter, PL_na), SvPV_nolen (HeVAL (iter)));
			}
		}
		else {
			if (nargs % 2 != 0)
				croak ("expected even number of attributes/values");

			for (i = 2; i <= nargs; i += 2) {
				xmmsv_coll_attribute_set_string (RETVAL, SvPV_nolen (ST (i)), SvPV_nolen (ST (i+1)));
			}
		}
#line 255 "../src/clients/lib/perl/XMMSClientCollection.c"
	{
	    SV * RETVALSV;
	    RETVALSV = perl_xmmsclient_new_sv_from_ptr (RETVAL, "Audio::XMMSClient::Collection");
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_parse); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_parse)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "class, pattern");
    {
#line 92 "../src/clients/lib/perl/XMMSClientCollection.xs"
		int ret;
#line 276 "../src/clients/lib/perl/XMMSClientCollection.c"
	xmmsv_t *	RETVAL;
	const char *	pattern = (const char *)SvPV_nolen(ST(1))
;
#line 94 "../src/clients/lib/perl/XMMSClientCollection.xs"
		ret = xmmsv_coll_parse (pattern, &RETVAL);
#line 282 "../src/clients/lib/perl/XMMSClientCollection.c"
#line 96 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (ret == 0)
			XSRETURN_UNDEF;
#line 286 "../src/clients/lib/perl/XMMSClientCollection.c"
	{
	    SV * RETVALSV;
	    RETVALSV = perl_xmmsclient_new_sv_from_ptr (RETVAL, "Audio::XMMSClient::Collection");
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
#line 105 "../src/clients/lib/perl/XMMSClientCollection.xs"
		xmmsv_unref (coll);
#line 309 "../src/clients/lib/perl/XMMSClientCollection.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_set_idlist); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_set_idlist)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "coll, ...");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
#line 128 "../src/clients/lib/perl/XMMSClientCollection.xs"
		int i;
		int *ids;
#line 327 "../src/clients/lib/perl/XMMSClientCollection.c"
#line 131 "../src/clients/lib/perl/XMMSClientCollection.xs"
		ids = (int *)malloc (sizeof (int) * items);

		for (i = 0; i < items - 1; i++) {
			ids[i] = SvUV (ST (i + 1));
			if (ids[i] == 0) {
				free (ids);
				croak("0 is an invalid mlib id");
			}
		}

		ids[items - 1] = 0;
#line 340 "../src/clients/lib/perl/XMMSClientCollection.c"

	xmmsv_coll_set_idlist(coll, ids);
#line 145 "../src/clients/lib/perl/XMMSClientCollection.xs"
		free (ids);
#line 345 "../src/clients/lib/perl/XMMSClientCollection.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_add_operand); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_add_operand)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "coll, op");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	xmmsv_t *	op = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(1), "Audio::XMMSClient::Collection")
;

	xmmsv_coll_add_operand(coll, op);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_remove_operand); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_remove_operand)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "coll, op");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	xmmsv_t *	op = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(1), "Audio::XMMSClient::Collection")
;

	xmmsv_coll_remove_operand(coll, op);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_append); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_append)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "coll, id");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	unsigned int	id = (unsigned int)SvUV(ST(1))
;
	int	RETVAL;
	dXSTARG;
#line 210 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (id == 0) {
			croak ("0 is an invalid mlib id");
		}
#line 404 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_idlist_append(coll, id);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_insert); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_insert)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "coll, index, id");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	int	index = (int)SvIV(ST(1))
;
	int	id = (int)SvIV(ST(2))
;
	int	RETVAL;
	dXSTARG;
#line 236 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (index > xmmsv_coll_idlist_get_size (coll)) {
			croak ("inserting id after end of idlist");
		}

		if (id == 0) {
			croak ("0 is an invalid mlib id");
		}
#line 437 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_idlist_insert(coll, index, id);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_move); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_move)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "coll, from, to");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	unsigned int	from = (unsigned int)SvUV(ST(1))
;
	unsigned int	to = (unsigned int)SvUV(ST(2))
;
#line 266 "../src/clients/lib/perl/XMMSClientCollection.xs"
		size_t idlist_len;
#line 462 "../src/clients/lib/perl/XMMSClientCollection.c"
	int	RETVAL;
	dXSTARG;
#line 268 "../src/clients/lib/perl/XMMSClientCollection.xs"
		idlist_len = xmmsv_coll_idlist_get_size (coll);

		if (from > idlist_len) {
			croak ("trying to move id from after the idlists end");
		}

		if (to >= idlist_len) {
			croak ("trying to move id to after the idlists end");
		}
#line 475 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_idlist_move(coll, from, to);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_clear); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_clear)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	int	RETVAL;
	dXSTARG;

	RETVAL = xmmsv_coll_idlist_clear(coll);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_get_index); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_get_index)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "coll, index");
    {
	int	RETVAL;
	dXSTARG;
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	int	index = (int)SvIV(ST(1))
;
	int32_t	val;
#line 317 "../src/clients/lib/perl/XMMSClientCollection.xs"
		PERL_UNUSED_VAR (targ);

		if (index > xmmsv_coll_idlist_get_size (coll)) {
			croak ("trying to get an id from behind the idlists end");
		}
#line 525 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_idlist_get_index(coll, index, &val);
#line 323 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (RETVAL == 0)
			XSRETURN_UNDEF;
#line 531 "../src/clients/lib/perl/XMMSClientCollection.c"
	XSprePUSH;	EXTEND(SP,1);
	PUSHs(sv_newmortal());
	sv_setiv(ST(0), (IV)val);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_set_index); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_set_index)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "coll, index, val");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	unsigned int	index = (unsigned int)SvUV(ST(1))
;
	int32_t	val = (int32_t)SvIV(ST(2))
;
#line 348 "../src/clients/lib/perl/XMMSClientCollection.xs"
		size_t idlist_len;
#line 555 "../src/clients/lib/perl/XMMSClientCollection.c"
	int	RETVAL;
	dXSTARG;
#line 350 "../src/clients/lib/perl/XMMSClientCollection.xs"
		idlist_len = xmmsv_coll_idlist_get_size (coll);
		if (idlist_len == 0 || index > idlist_len - 1) {
			croak ("trying to set an id after the end of the idlist");
		}
#line 563 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_idlist_set_index(coll, index, val);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_get_size); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_idlist_get_size)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	size_t	RETVAL;
	dXSTARG;

	RETVAL = xmmsv_coll_idlist_get_size(coll);
	XSprePUSH;
	PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_get_type); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_get_type)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	xmmsv_coll_type_t	RETVAL;

	RETVAL = xmmsv_coll_get_type(coll);
	{
	    SV * RETVALSV;
	    RETVALSV = sv_newmortal();
	    {
		    RETVALSV = newSVpv ("", 0);
		    if (RETVAL == XMMS_COLLECTION_TYPE_REFERENCE) {
			    sv_setpv (RETVALSV, "reference");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_UNIVERSE) {
			    sv_setpv (RETVALSV, "universe");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_UNION) {
			    sv_setpv (RETVALSV, "union");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_INTERSECTION) {
			    sv_setpv (RETVALSV, "intersection");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_COMPLEMENT) {
			    sv_setpv (RETVALSV, "complement");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_HAS) {
			    sv_setpv (RETVALSV, "has");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_EQUALS) {
			    sv_setpv (RETVALSV, "equals");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_NOTEQUAL) {
			    sv_setpv (RETVALSV, "notequal");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_MATCH) {
			    sv_setpv (RETVALSV, "match");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_SMALLER) {
			    sv_setpv (RETVALSV, "smaller");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_SMALLEREQ) {
			    sv_setpv (RETVALSV, "smallereq");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_GREATER) {
			    sv_setpv (RETVALSV, "greater");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_GREATEREQ) {
			    sv_setpv (RETVALSV, "greatereq");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_ORDER) {
			    sv_setpv (RETVALSV, "order");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_LIMIT) {
			    sv_setpv (RETVALSV, "limit");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_MEDIASET) {
			    sv_setpv (RETVALSV, "mediaset");
		    }
		    else if (RETVAL == XMMS_COLLECTION_TYPE_IDLIST) {
			    sv_setpv (RETVALSV, "idlist");
		    }
		    else {
			    croak ("unknown XMMSV_COLL_TYPE_T");
		    }
	    }
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_get_idlist); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_get_idlist)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
#line 419 "../src/clients/lib/perl/XMMSClientCollection.xs"
		xmmsv_list_iter_t *it;
		int32_t entry;
#line 686 "../src/clients/lib/perl/XMMSClientCollection.c"
#line 422 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (!xmmsv_get_list_iter (xmmsv_coll_idlist_get (coll), &it))
			XSRETURN_UNDEF;

		EXTEND (sp, xmmsv_coll_idlist_get_size (coll));

		for (xmmsv_list_iter_first (it);
		     xmmsv_list_iter_valid (it);
		     xmmsv_list_iter_next (it)) {

			xmmsv_list_iter_entry_int (it, &entry);
			PUSHs (sv_2mortal (newSVuv (entry)));
		}
		xmmsv_list_iter_explicit_destroy (it);
#line 701 "../src/clients/lib/perl/XMMSClientCollection.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_operands); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_operands)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
#line 458 "../src/clients/lib/perl/XMMSClientCollection.xs"
		xmmsv_t *operands_list;
		xmmsv_list_iter_t *it;
		xmmsv_t *value;
#line 724 "../src/clients/lib/perl/XMMSClientCollection.c"
#line 462 "../src/clients/lib/perl/XMMSClientCollection.xs"
		PERL_UNUSED_VAR (ix);

		operands_list = xmmsv_coll_operands_get (coll);

		for (xmmsv_get_list_iter (operands_list, &it);
		     xmmsv_list_iter_entry (it, &value);
		     xmmsv_list_iter_next (it)) {
			XPUSHs (sv_2mortal (perl_xmmsclient_new_sv_from_ptr (xmmsv_ref (value), "Audio::XMMSClient::Collection")));
		}

		xmmsv_list_iter_explicit_destroy (it);
#line 737 "../src/clients/lib/perl/XMMSClientCollection.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_set_string); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_set_string)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 3)
       croak_xs_usage(cv,  "coll, key, value");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	const char *	key = (const char *)SvPV_nolen(ST(1))
;
	const char *	value = (const char *)SvPV_nolen(ST(2))
;
#line 498 "../src/clients/lib/perl/XMMSClientCollection.xs"
		PERL_UNUSED_VAR (ix);
#line 760 "../src/clients/lib/perl/XMMSClientCollection.c"

	xmmsv_coll_attribute_set_string(coll, key, value);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_remove); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_remove)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "coll, key");
    {
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	const char *	key = (const char *)SvPV_nolen(ST(1))
;
	int	RETVAL;
	dXSTARG;

	RETVAL = xmmsv_coll_attribute_remove(coll, key);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_get_string); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_get_string)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items != 2)
       croak_xs_usage(cv,  "coll, key");
    {
	int	RETVAL;
	dXSTARG;
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
	const char *	key = (const char *)SvPV_nolen(ST(1))
;
	const char *	val;
#line 543 "../src/clients/lib/perl/XMMSClientCollection.xs"
		PERL_UNUSED_VAR (targ);
		PERL_UNUSED_VAR (ix);
#line 808 "../src/clients/lib/perl/XMMSClientCollection.c"

	RETVAL = xmmsv_coll_attribute_get_string(coll, key, &val);
#line 546 "../src/clients/lib/perl/XMMSClientCollection.xs"
		if (RETVAL == 0)
			XSRETURN_UNDEF;
#line 814 "../src/clients/lib/perl/XMMSClientCollection.c"
	XSprePUSH;	EXTEND(SP,1);
	PUSHs(sv_newmortal());
	sv_setpv((SV*)ST(0), val);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_list); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_attribute_list)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "coll");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 568 "../src/clients/lib/perl/XMMSClientCollection.xs"
		xmmsv_dict_iter_t *it;
		const char *key;
		const char *value;
#line 836 "../src/clients/lib/perl/XMMSClientCollection.c"
	xmmsv_t *	coll = (xmmsv_t *)perl_xmmsclient_get_ptr_from_sv (ST(0), "Audio::XMMSClient::Collection")
;
#line 572 "../src/clients/lib/perl/XMMSClientCollection.xs"
		xmmsv_get_dict_iter (xmmsv_coll_attributes_get (coll), &it);

		for (xmmsv_dict_iter_first (it);
		     xmmsv_dict_iter_valid (it);
		     xmmsv_dict_iter_next (it)) {

			xmmsv_dict_iter_pair_string (it, &key, &value);

			EXTEND (sp, 2);
			mPUSHp (key, strlen (key));
			mPUSHp (value, strlen (value));
		}

		xmmsv_dict_iter_explicit_destroy (it);
#line 854 "../src/clients/lib/perl/XMMSClientCollection.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Audio__XMMSClient__Collection_universe); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Audio__XMMSClient__Collection_universe)
{
    dVAR; dXSARGS;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "class=\"optional\"");
    {
	xmmsv_t *	RETVAL;
#line 607 "../src/clients/lib/perl/XMMSClientCollection.xs"
		warn ("Audio::XMMSClientCollection::universe is deprecated, use Audio::XMMSClientCollection::new(\"universe\") instead.");
		RETVAL = xmmsv_new_coll (XMMS_COLLECTION_TYPE_UNIVERSE);
#line 872 "../src/clients/lib/perl/XMMSClientCollection.c"
	{
	    SV * RETVALSV;
	    RETVALSV = perl_xmmsclient_new_sv_from_ptr (RETVAL, "Audio::XMMSClient::Collection");
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Audio__XMMSClient__Collection); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Audio__XMMSClient__Collection)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        newXS_deffile("Audio::XMMSClient::Collection::new", XS_Audio__XMMSClient__Collection_new);
        newXS_deffile("Audio::XMMSClient::Collection::parse", XS_Audio__XMMSClient__Collection_parse);
        newXS_deffile("Audio::XMMSClient::Collection::DESTROY", XS_Audio__XMMSClient__Collection_DESTROY);
        newXS_deffile("Audio::XMMSClient::Collection::set_idlist", XS_Audio__XMMSClient__Collection_set_idlist);
        newXS_deffile("Audio::XMMSClient::Collection::add_operand", XS_Audio__XMMSClient__Collection_add_operand);
        newXS_deffile("Audio::XMMSClient::Collection::remove_operand", XS_Audio__XMMSClient__Collection_remove_operand);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_append", XS_Audio__XMMSClient__Collection_idlist_append);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_insert", XS_Audio__XMMSClient__Collection_idlist_insert);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_move", XS_Audio__XMMSClient__Collection_idlist_move);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_clear", XS_Audio__XMMSClient__Collection_idlist_clear);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_get_index", XS_Audio__XMMSClient__Collection_idlist_get_index);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_set_index", XS_Audio__XMMSClient__Collection_idlist_set_index);
        newXS_deffile("Audio::XMMSClient::Collection::idlist_get_size", XS_Audio__XMMSClient__Collection_idlist_get_size);
        newXS_deffile("Audio::XMMSClient::Collection::get_type", XS_Audio__XMMSClient__Collection_get_type);
        newXS_deffile("Audio::XMMSClient::Collection::get_idlist", XS_Audio__XMMSClient__Collection_get_idlist);
        cv = newXS_deffile("Audio::XMMSClient::Collection::operand_list", XS_Audio__XMMSClient__Collection_operands);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Audio::XMMSClient::Collection::operands", XS_Audio__XMMSClient__Collection_operands);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Audio::XMMSClient::Collection::attribute_set", XS_Audio__XMMSClient__Collection_attribute_set_string);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Audio::XMMSClient::Collection::attribute_set_string", XS_Audio__XMMSClient__Collection_attribute_set_string);
        XSANY.any_i32 = 0;
        newXS_deffile("Audio::XMMSClient::Collection::attribute_remove", XS_Audio__XMMSClient__Collection_attribute_remove);
        cv = newXS_deffile("Audio::XMMSClient::Collection::attribute_get", XS_Audio__XMMSClient__Collection_attribute_get_string);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Audio::XMMSClient::Collection::attribute_get_string", XS_Audio__XMMSClient__Collection_attribute_get_string);
        XSANY.any_i32 = 0;
        newXS_deffile("Audio::XMMSClient::Collection::attribute_list", XS_Audio__XMMSClient__Collection_attribute_list);
        newXS_deffile("Audio::XMMSClient::Collection::universe", XS_Audio__XMMSClient__Collection_universe);

    /* Initialisation Section */

#line 631 "../src/clients/lib/perl/XMMSClientCollection.xs"
	PERL_UNUSED_VAR (items);

#line 947 "../src/clients/lib/perl/XMMSClientCollection.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

