Commit 7dd57040 authored by Owen Fraser-Green's avatar Owen Fraser-Green

Added support for enumerations with marshalling to/from their underlying...

Added support for enumerations with marshalling to/from their underlying system type (Byte, Int32, UInt32, Int64, UInt64)
parent e29f0448
......@@ -41,6 +41,10 @@ namespace DBus.DBusType
public static bool Suits(System.Type type)
{
if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Byte)) {
return true;
}
switch (type.ToString()) {
case "System.Byte":
case "System.Byte&":
......@@ -75,6 +79,10 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
if (type.IsEnum) {
return Enum.ToObject(type, this.val);
}
switch (type.ToString()) {
case "System.Byte":
case "System.Byte&":
......
......@@ -36,11 +36,14 @@ namespace DBus.DBusType
public static bool Suits(System.Type type)
{
if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Int32)) {
return true;
}
switch (type.ToString()) {
case "System.Int32":
case "System.Int32&":
return true;
}
return true; }
return false;
}
......@@ -68,6 +71,10 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
if (type.IsEnum) {
return Enum.ToObject(type, this.val);
}
switch (type.ToString()) {
case "System.Int32":
case "System.Int32&":
......
......@@ -36,6 +36,10 @@ namespace DBus.DBusType
public static bool Suits(System.Type type)
{
if (type.IsEnum && type.UnderlyingSystemType == typeof(System.Int64)) {
return true;
}
switch (type.ToString()) {
case "System.Int64":
case "System.Int64&":
......@@ -68,6 +72,10 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
if (type.IsEnum) {
return Enum.ToObject(type, this.val);
}
switch (type.ToString()) {
case "System.Int64":
case "System.Int64&":
......
......@@ -36,6 +36,10 @@ namespace DBus.DBusType
public static bool Suits(System.Type type)
{
if (type.IsEnum && type.UnderlyingSystemType == typeof(System.UInt32)) {
return true;
}
switch (type.ToString()) {
case "System.UInt32":
case "System.UInt32&":
......@@ -68,6 +72,10 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
if (type.IsEnum) {
return Enum.ToObject(type, this.val);
}
switch (type.ToString())
{
case "System.UInt32":
......
......@@ -36,6 +36,10 @@ namespace DBus.DBusType
public static bool Suits(System.Type type)
{
if (type.IsEnum && type.UnderlyingSystemType == typeof(System.UInt64)) {
return true;
}
switch (type.ToString()) {
case "System.UInt64":
case "System.UInt64&":
......@@ -68,6 +72,10 @@ namespace DBus.DBusType
public object Get(System.Type type)
{
if (type.IsEnum) {
return Enum.ToObject(type, this.val);
}
switch (type.ToString())
{
case "System.UInt64":
......
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