C# Class Uiml.Rendering.TypeDecoding.TypeDecoder

Class to convert between different types, amongst others to convert (typeless) data values from the UIML document to the types required by the specific toolkit (e.g. '255,0,0' to an instance of System.Drawing.Color).
Implements the Singleton pattern. http://msdn2.microsoft.com/en-us/library/ms954629.aspx
Inheritance: ITypeDecoder
Exibir arquivo Open project: jozilla/Uiml.net

Public Properties

Property Type Description
Instance TypeDecoder
PARSE string
SYSTEM_CONVERT_TYPES List

Protected Properties

Property Type Description
m_registry TypeDecoderRegistry

Public Methods

Method Description
GetArg ( object o, Type t ) : object
GetArgs ( System.Property p, Type types ) : object[]
GetMultipleArgs ( System.Property p, Type types ) : object[]

Given an array of properties and an array of types, this method will create an array of objects by converting each property value (p[i].Value) into its appropriate type according to the Type array (types[i]).

HasDecoder ( Type from, Type to ) : bool

Checks whether a decoder exists for a certain signature.

HasDecoder ( Type from, Type to, bool deep ) : bool

Checks whether a decoder exists for a certain signature.

HasDecoder ( string from, string to ) : bool

Checks whether a decoder exists for a certain signature.

HasDecoder ( string from, string to, bool deep ) : bool

Checks whether a decoder exists for a certain signature.

Register ( Assembly a ) : void
Register ( MethodInfo method ) : void

Register a new function for type decoding. The from and to types are automatically extracted.

Register ( Type t ) : void

Protected Methods

Method Description
ConvertComplex ( Type t, System.Property p ) : object

Helper function to convert a property to a complex type.

ConvertComplex ( Type t, object oValue ) : object

Utility function to convert an arbitrary object to a complex type.

ConvertPrimitive ( Type t, System.Property p ) : object

Helper function to convert a property's value to a primitive type (e.g. char, int, float, ...).

ConvertPrimitive ( Type t, System oValue ) : object

Utility function to convert an arbitrary object to a primitive type using the object's Parse method (like the one in System.String).

SystemConvert ( Type t, object o ) : object

Private Methods

Method Description
TypeDecoder ( ) : Uiml.Utils.Reflection

Method Details

ConvertComplex() protected method

Helper function to convert a property to a complex type.
protected ConvertComplex ( Type t, System.Property p ) : object
t System.Type
p System.Property
return object

ConvertComplex() protected method

Utility function to convert an arbitrary object to a complex type.
protected ConvertComplex ( Type t, object oValue ) : object
t System.Type
oValue object
return object

ConvertPrimitive() protected method

Helper function to convert a property's value to a primitive type (e.g. char, int, float, ...).
protected ConvertPrimitive ( Type t, System.Property p ) : object
t System.Type
p System.Property
return object

ConvertPrimitive() protected method

Utility function to convert an arbitrary object to a primitive type using the object's Parse method (like the one in System.String).
protected ConvertPrimitive ( Type t, System oValue ) : object
t System.Type
oValue System
return object

GetArg() public method

public GetArg ( object o, Type t ) : object
o object
t System.Type
return object

GetArgs() public method

public GetArgs ( System.Property p, Type types ) : object[]
p System.Property
types System.Type
return object[]

GetMultipleArgs() public method

Given an array of properties and an array of types, this method will create an array of objects by converting each property value (p[i].Value) into its appropriate type according to the Type array (types[i]).
public GetMultipleArgs ( System.Property p, Type types ) : object[]
p System.Property
types System.Type
return object[]

HasDecoder() public method

Checks whether a decoder exists for a certain signature.
public HasDecoder ( Type from, Type to ) : bool
from System.Type The type that we want to decode from
to System.Type The type that we want to decode to
return bool

HasDecoder() public method

Checks whether a decoder exists for a certain signature.
public HasDecoder ( Type from, Type to, bool deep ) : bool
from System.Type The type that we want to decode from
to System.Type The type that we want to decode to
deep bool If true, specifies that we want to include indirect type decoders (e.g. types A->C through A->B and B->C)
return bool

HasDecoder() public method

Checks whether a decoder exists for a certain signature.
public HasDecoder ( string from, string to ) : bool
from string The name of the type that we want to decode from
to string The name of the type that we want to decode to
return bool

HasDecoder() public method

Checks whether a decoder exists for a certain signature.
public HasDecoder ( string from, string to, bool deep ) : bool
from string The name of the type that we want to decode from
to string The name of the type that we want to decode to
deep bool If true, specifies that we want to include indirect type decoders (e.g. types A->C through A->B and B->C)
return bool

Register() public method

public Register ( Assembly a ) : void
a System.Reflection.Assembly
return void

Register() public method

Register a new function for type decoding. The from and to types are automatically extracted.
/// Thrown when method does not have exactly one /// argument and a non-void return type. ///
public Register ( MethodInfo method ) : void
method System.Reflection.MethodInfo /// The function we want to register as a type decoder. ///
return void

Register() public method

public Register ( Type t ) : void
t System.Type
return void

SystemConvert() protected method

protected SystemConvert ( Type t, object o ) : object
t System.Type
o object
return object

Property Details

Instance public_oe static_oe property

public static TypeDecoder,Uiml.Rendering.TypeDecoding Instance
return TypeDecoder

PARSE public_oe static_oe property

public static string PARSE
return string

SYSTEM_CONVERT_TYPES public_oe static_oe property

public static List SYSTEM_CONVERT_TYPES
return List

m_registry protected_oe property

protected TypeDecoderRegistry m_registry
return TypeDecoderRegistry