Files
lazarus-ccr/applications/gobject-introspection/girpascalwriter.pas
drewski207 8fdb7bbd70 gir2pascal changes:
- Added option --max-version. It allows to limit the version of the symbols to a particular version. i.e. Gtk-3.8 when run against 3.14.
 - Added option --keep-deprecated-version. It allow to reduce the version that will exclude deprecated symbols. i.e using --keep-deprecated-version=Gtk-3.8 on version 3.14 will include all symbols from 3.8 up to the current when normally they would be dropped.
 - Some changes to accomodate new nodes in the gir xml files.


git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5356 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2016-11-17 02:54:44 +00:00

83 lines
2.2 KiB
ObjectPascal

{
girpascalwriter.pas
Copyright (C) 2011 Andrew Haines andrewd207@aol.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
}
unit girpascalwriter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,girNameSpaces, girpascalwritertypes;
type
{ TgirPascalWriter }
TgirPascalWriter = class
private
FDefaultUnitExtension: String;
FUnitPrefix: String;
FOnUnitWriteEvent: TgirWriteEvent;
FNameSpaces: TgirNamespaces;
FUnits: TList;
FOptions: TgirOptions;
public
constructor Create(ANameSpaces: TgirNamespaces; AOptions: TgirOptions; AUnitPrefix: String);
procedure GenerateUnits;
property OnUnitWriteEvent: TgirWriteEvent read FOnUnitWriteEvent write FOnUnitWriteEvent;
property DefaultUnitExtension: String read FDefaultUnitExtension write FDefaultUnitExtension; // is .pas by default
property Units: TList read FUnits;
end;
implementation
uses girCTypesMapping;
{ TgirPascalWriter }
constructor TgirPascalWriter.Create(ANameSpaces: TgirNamespaces; AOptions: TgirOptions; AUnitPrefix: String);
begin
FNameSpaces := ANameSpaces;
FUnitPrefix := AUnitPrefix;
FUnits := TList.Create;
FDefaultUnitExtension:='.pas';
FOptions:=AOptions;
FUnitPrefix:=AUnitPrefix;
end;
procedure TgirPascalWriter.GenerateUnits;
var
i: Integer;
UnitGroup: TPascalUnitGroup;
begin
for i := 0 to FNameSpaces.Count-1 do
begin
WriteLn(Format('Converting %s', [FNameSpaces.NameSpace[i].NameSpace]));
UnitGroup := TPascalUnitGroup.Create(Self, FNameSpaces.NameSpace[i], FOptions, FUnitPrefix);
UnitGroup.GenerateUnits;
end;
end;
end.