mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-07 21:28:01 +02:00
Added support for enumerations with marshalling to/from their underlying system type (Byte, Int32, UInt32, Int64, UInt64)
This commit is contained in:
parent
e29f0448ec
commit
7dd5704023
5 changed files with 41 additions and 2 deletions
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue