Exemplo n.º 1
0
	CollPtr
	Collection::parse( const std::string& pattern ) const
	{
		xmmsv_coll_t* coll;

		if( !xmmsv_coll_parse( pattern.c_str(), &coll ) ) {
			throw collection_parsing_error( "invalid collection pattern" );
		}

		return CollResult::createColl( coll );
	}
Exemplo n.º 2
0
/* call-seq:
 * c = Xmms::Collection.parse(pattern)
 *
 * Returns a collection matching a String _pattern_. See the wiki for details
 * on how to construct a pattern string.
 */
static VALUE
c_coll_parse (VALUE klass, VALUE pattern)
{
	VALUE obj = rb_obj_alloc (klass);
	RbCollection *coll = NULL;

	Data_Get_Struct (obj, RbCollection, coll);

	if (!xmmsv_coll_parse (StringValuePtr (pattern), &coll->real)) {
		rb_raise (ePatternError, "invalid pattern");
	}

	return obj;
}