Commit da1adead authored by Mike Wey's avatar Mike Wey
Browse files

Add char parameters to DClosure.

Closes #283
parent a697da9f
......@@ -160,7 +160,7 @@ class DClosure : Closure
call ~= "g_value_set_boolean(return_value, ret);";
else static if ( is(Ret == byte) )
call ~= "g_value_set_schar(return_value, ret);";
else static if ( is(Ret == ubyte) )
else static if ( is(Ret == ubyte) || is(Ret == char) )
call ~= "g_value_set_uchar(return_value, ret);";
else static if ( is(Ret == int) )
call ~= "g_value_set_int(return_value, ret);";
......@@ -207,7 +207,7 @@ class DClosure : Closure
return "g_value_get_boolean(&param_values["~to!string(index)~"]) != 0";
else static if ( is(Param == byte) )
return "g_value_get_schar(&param_values["~to!string(index)~"])";
else static if ( is(Param == ubyte) )
else static if ( is(Param == ubyte) || is(Param == char) )
return "g_value_get_uchar(&param_values["~to!string(index)~"])";
else static if ( is(Param == int) )
return "g_value_get_int(&param_values["~to!string(index)~"])";
......
......@@ -120,6 +120,15 @@ public class Value
setBoolean(value);
}
/** */
this(CHAR)(CHAR value)
if( is(CHAR == char) )
{
this();
init(GType.UCHAR);
setUchar(value);
}
/** */
this(INT)(INT value)
if ( isIntegral!INT )
......@@ -188,7 +197,7 @@ public class Value
return getBoolean();
else static if ( is(TYPE == byte) )
return getSchar();
else static if ( is(TYPE == ubyte) )
else static if ( is(TYPE == ubyte) || is(TYPE == char) )
return getUchar();
else static if ( is(TYPE == int) )
return getInt();
......@@ -995,8 +1004,8 @@ public class Value
/**
* Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed
* and takes over the ownership of the callers reference to @v_boxed;
* the caller doesn't have to unref it any more.
* and takes over the ownership of the callers reference to @v_boxed;
* the caller doesnt have to unref it any more.
*
* Params:
* vBoxed = duplicated unowned boxed value to be set
......@@ -1010,8 +1019,8 @@ public class Value
/**
* Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object
* and takes over the ownership of the callers reference to @v_object;
* the caller doesn't have to unref it any more (i.e. the reference
* and takes over the ownership of the callers reference to @v_object;
* the caller doesnt have to unref it any more (i.e. the reference
* count of the object is not increased).
*
* If you want the #GValue to hold its own reference to @v_object, use
......@@ -1029,8 +1038,8 @@ public class Value
/**
* Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes
* over the ownership of the callers reference to @param; the caller
* doesn't have to unref it any more.
* over the ownership of the callers reference to @param; the caller
* doesnt have to unref it any more.
*
* Params:
* param = the #GParamSpec to be set
......
......@@ -265,7 +265,7 @@ code: start
call ~= "g_value_set_boolean(return_value, ret);";
else static if ( is(Ret == byte) )
call ~= "g_value_set_schar(return_value, ret);";
else static if ( is(Ret == ubyte) )
else static if ( is(Ret == ubyte) || is(Ret == char) )
call ~= "g_value_set_uchar(return_value, ret);";
else static if ( is(Ret == int) )
call ~= "g_value_set_int(return_value, ret);";
......@@ -312,7 +312,7 @@ code: start
return "g_value_get_boolean(&param_values["~to!string(index)~"]) != 0";
else static if ( is(Param == byte) )
return "g_value_get_schar(&param_values["~to!string(index)~"])";
else static if ( is(Param == ubyte) )
else static if ( is(Param == ubyte) || is(Param == char) )
return "g_value_get_uchar(&param_values["~to!string(index)~"])";
else static if ( is(Param == int) )
return "g_value_get_int(&param_values["~to!string(index)~"])";
......@@ -889,6 +889,15 @@ code: start
setBoolean(value);
}
/** */
this(CHAR)(CHAR value)
if( is(CHAR == char) )
{
this();
init(GType.UCHAR);
setUchar(value);
}
/** */
this(INT)(INT value)
if ( isIntegral!INT )
......@@ -957,7 +966,7 @@ code: start
return getBoolean();
else static if ( is(TYPE == byte) )
return getSchar();
else static if ( is(TYPE == ubyte) )
else static if ( is(TYPE == ubyte) || is(TYPE == char) )
return getUchar();
else static if ( is(TYPE == int) )
return getInt();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment