//TH-Header //***************************************************************************************** // Copyright (c) 2001 Michael Kurz // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : cTypeConverter.pkg // $ProjectName : Shared Classes // $Author : Michael Kurz // $Created : 21.05.2001 20:26 // // Contents: // Converts C++ Datatypes to VDF Datatypes. // -> Information is taken out of a file: "TypeConversion.type" // //***************************************************************************************** //TH-RevisionStart //TH-RevisionEnd Use Set Use mFileTime.pkg Class cTypeConverter Is a Array //Insert your Properties here. Procedure Construct_Object Forward Send Construct_Object Property String psDataFile "TypeConversion.type" Property Number pnFileTimeStamp 0 Object oSrc Is a Set End_Object Object oDest Is an Array End_Object End_Procedure // Empties the Converter. Procedure Reset Send Delete_Data To (oSrc(Self)) Send Delete_Data To (oDest(Self)) End_Procedure // New Entry Procedure AddNewType String sSrc String sDest Integer iC Get Item_Count Of (oSrc(Self)) To iC Set Value Of (oSrc(Self)) Item iC To sSrc Set Value Of (oDest(Self)) Item iC To sDest End_Procedure //Fills the type conversions Procedure Fill String sSrc sDest Send Reset Direct_Input (psDataFile(Self)) Repeat ReadLn sSrc sDest [Not Seqeof] If (Left(Trim(sSrc),2)) Ne ("/"+"/") Begin Send AddNewType (Lowercase(sSrc)) sDest End Until [Seqeof] Close_Input End_Procedure // Does only a fill is the Datafile has changed. Procedure Request_Fill Number nFileTime String sFile Get psDataFile To sFile Get_File_Path sFile To sFile If sFile Eq "" Procedure_Return Move (MKTimeStampOfFile(sFile)) To nFileTime If nFileTime Ne (pnFileTimeStamp(Self)) Begin Set pnFileTimeStamp To nFileTime Send Fill End End_Procedure // Converts a Datatype-> If no conversion was possible // return the SRC value. Function ConvertType String sSrc Returns String Integer iC Get Find_Element Of (oSrc(Self)) (Lowercase(sSrc)) To iC If iC Ge 0 Function_Return (Value(oDest(Self),iC)) Function_Return sSrc End_Function //Finish object construction Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure End_Class Global_Variable Integer ghoTypeConverter Object oTypeConverter Is a cTypeConverter Move Self To ghoTypeConverter End_Object // The conversion routine. Function ConvertCToDFType Global String sCType Returns String Send Request_Fill To ghoTypeConverter Function_Return (ConvertType(ghoTypeConverter,sCType)) End_Function