Added support for enumerations with marshalling to/from their underlying system type (Byte, Int32, UInt32, Int64, UInt64)

This commit is contained in:
Owen Fraser-Green 2004-03-25 14:04:43 +00:00
parent e29f0448ec
commit 7dd5704023
5 changed files with 41 additions and 2 deletions

View file

@ -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&":

View file

@ -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&":

View file

@ -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&":

View file

@ -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":

View file

@ -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":