NeverPas Outline - GFF Object The GFF Object allows us to read and write GFF data to and from files, using a system similar to a 'state machine' for data access. Consider the following (generalized) GFF Data. Top Structure (FFFFFFFF) Label1 ----------> String Data Label2 ----------> Integer Label3 ----------> Sub Structure (StructID 2) Label4 ----------> Integer Label5 ----------> Float Label6 ----------> Char One method to read this data is to use a series of functions to get the data. (the whitespace is to show how the state works) GFF.Open('mygffdata.gff'); // open the GFF file GFF.Verify('GFF','V3.2'); // verify that the GFF header/file is valid GFF.EnterStructure($FFFFFFFF); // open the main structure MyString := GFF.GetString('Label1','DefaultString'); // read the string data by label name MyInteger1 := GFF.GetInteger('Label2',0); // read the integer by label GFF.EnterStructure(2); // enter the first structure in the current struct with StructID 2. // this always opens the first with the given StructID MyInteger2 := GFF.GetInteger('Label4',0); MyFloat := GFF.GetFloat('Label5',0.0); GFF.PreviousStructure; // go back to parent structure MyChar := GFF.GetChar('Label6','A'); GFF.Close; // close the GFF file The GFF class has a number of functions for retrieving GFF data. They all follow these specifications: GFF.Get(Label: String; Default: ): DataType; Examples: GFF.GetByte(Label:String; Default: Byte): Byte; GFF.GetFloat(Label: String; Default: Float): Float; The default parameter is /optional/. Special: GetBinary() is different, (using Binary instead of Void, to avoid confusion). GetBinary() returns a stream filled with the data. GetBinary(Label: String; Default: TStream): TStream; The class also has the following functions: GFF NAVIGATION ============== EnterStructure(StructID: DWORD); Enters the first structure inside the current structure with the given StructID. Legal GFF files shouldn't have more than one of the same Structure inside a single structure (remember, Lists are fields, not structures) EnterList(Label: String): DWORD; Enters a list inside the current structure. Returns the number of list elements. EnterListStructure(Index: DWord); Enters the structure in the list with the given index. Otherwise acts as EnterStructure ExitStructure(); Returns to the current structure's parent. If at top level, this function does nothing. ExitList(); Returns to the current list's parent structure. EnterTopLevelStructure(); Sets the current structure to the top level parent structure that holds everything in the GFF. GFF STRUCTURE ============= GetLabels(var List: TStringList); Returns a list of strings for all the labels in the current structure. Used to make sure a field exists, or for use in GFF files where the contents are not known. GetStructures(var List: T