C# Class kOS.Safe.Utilities.KOSNomenclature

A class for the purpose of holding the mapping information that goes back and forth between C# type names and thier KOS type name equivalents. Any time you add a new class derived from kOS.Safe.Encapsulated.Structure, you should check to see if you should add a mapping to this class to go with it. This class is intended to be used "statically" without an actual instance of it being necessary. There should be only one copy of its data, globally, across the entire process.
Show file Open project: KSP-KOS/KOS

Public Methods

Method Description
GetCSharpName ( string kosName ) : Type

Return the C# type corresponding to a kOS type name.

GetKOSName ( Type cSharpType ) : string

Return the kOS type name corresponding to a C# type. Never bombs out, instead returning the original type's name as-is if it wasn't found in the lookup. This is a case-sensitive lookup because C# type names are case sensitive and there could hypothetically be two different type names that differ by case only.

HasKOSName ( Type cSharpType ) : bool

RReturns true if the cSharp type has a mapping in the table.

PopulateType ( Type t ) : void

Populate the nomenclature dictionaries based on the given type, which inherits from Structure. This method is automatically called by the AssemblyWalkAttribute

Private Methods

Method Description
KOSNomenclature ( ) : System
NagCheck ( Type t ) : void

Report nag message on terminal if there is a C# type derived from kOS.Safe.Encapsulated.Structure which was not given a KOSNomenclatureAttribute to work from. All Structure derivatives will need to be given at least one KOS name by being given such an attribute.

Method Details

GetCSharpName() public static method

Return the C# type corresponding to a kOS type name.
public static GetCSharpName ( string kosName ) : Type
kosName string
return System.Type

GetKOSName() public static method

Return the kOS type name corresponding to a C# type. Never bombs out, instead returning the original type's name as-is if it wasn't found in the lookup. This is a case-sensitive lookup because C# type names are case sensitive and there could hypothetically be two different type names that differ by case only.
public static GetKOSName ( Type cSharpType ) : string
cSharpType System.Type
return string

HasKOSName() public static method

RReturns true if the cSharp type has a mapping in the table.
public static HasKOSName ( Type cSharpType ) : bool
cSharpType System.Type
return bool

PopulateType() public static method

Populate the nomenclature dictionaries based on the given type, which inherits from Structure. This method is automatically called by the AssemblyWalkAttribute
public static PopulateType ( Type t ) : void
t System.Type A type inheriting from Structure
return void