unit fparameters;
(* ***** BEGIN LICENSE BLOCK *****
* Copyright (C) 2004 Durand Emmanuel
* Copyright (C) 2004 Burgel Eric
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact :
* filters@edurand.com
* filters@burgel.com
*
* ***** END LICENSE BLOCK ***** *)
{
edurand (filters@edurand.com)
eburgel (filters@burgel.com)
}
interface
uses
Classes, Windows, SysUtils, image;
type
//*** Parameters description ***
EParameterInvalidDataType = class(Exception);
EParameterNotFound = class(Exception);
EParameterValueOutOfBound = class(Exception);
TDataType = (dtImage,dtInteger,dtIntegerArray2D,dtString,dtBoolean,dtSingle,
dtImages,dtArrayIntegers,dtArraySingles,dtArrayPointers,dtPointer);
TParameter = class(TObject)
DataType : TDataType;
Name : String;
Help : String;
constructor Create( aName, aHelp : String);
end;
TParameterBoolean = class(TParameter)
public
Value : Boolean;
constructor Create(aName,aDescription : String; defaultValue:Boolean);
end;
TParameterInteger = class(TParameter)
public
Value : Int64;
Min, Max : Int64;
constructor Create(aName,aDescription : String;aMin,aMax,defaultValue:Int64);
end;
TParameterSingle = class(TParameter)
public
Value : single;
Min, Max : Single;
constructor Create(aName,aDescription : String;aMin,aMax,defaultValue:Single);
end;
TParameterString = class(TParameter)
public
Value : String;
constructor Create(aName,aDescription : String;defaultValue:String);
end;
TParameterImage = class(TParameter)
public
Image : PBitmap32;
constructor Create(aName,aDescription : String);
end;
TParameterImages = class(TParameter)
public
Images : ArrayOfPBitmap32;
constructor Create(aName,aDescription : String);
end;
TParameterArrayIntegers = class(TParameter)
public
Integers : array of Integer;
constructor Create(aName,aDescription : String);
end;
TParameterArraySingles = class(TParameter)
public
Singles : array of Single;
constructor Create(aName,aDescription : String);
end;
TParameterArrayPointers = class(TParameter)
public
Pointers : array of Pointer;
constructor Create(aName,aDescription : String);
end;
TParameterPointer = class(TParameter)
public
Value : Pointer;
constructor Create(aName,aDescription : String);
end;
implementation
{ TParameter }
constructor TParameter.Create(aName, aHelp: String);
begin
Name := aName;
Help := aHelp;
end;
constructor TParameterBoolean.Create(aName,aDescription : String;
defaultValue:Boolean);
Begin
inherited Create(aName,aDescription);
DataType:=dtBoolean;
Value:=defaultValue;
end;
{ TParameterInteger }
constructor TParameterInteger.Create(aName, aDescription: String; aMin, aMax,
defaultValue: Int64);
begin
inherited Create(aName,aDescription);
DataType:=dtInteger;
Min:=aMin;
Max:=aMax;
Value:=defaultValue;
end;
{ TParameterSingle }
constructor TParameterSingle.Create(aName, aDescription: String; aMin, aMax,
defaultValue: Single);
begin
inherited Create(aName,aDescription);
DataType:=dtSingle;
Min:=aMin;
Max:=aMax;
Value:=defaultValue;
end;
{ TParameterString }
constructor TParameterString.Create(aName, aDescription: String; defaultValue: String);
begin
inherited Create(aName,aDescription);
DataType:=dtString;
Value:=defaultValue;
end;
constructor TParameterImage.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtImage;
end;
constructor TParameterImages.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtImages;
end;
constructor TParameterArrayIntegers.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtArrayIntegers;
end;
constructor TParameterArraySingles.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtArraySingles;
end;
constructor TParameterArrayPointers.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtArrayPointers;
end;
constructor TParameterPointer.Create(aName, aDescription: String);
begin
inherited Create(aName,aDescription);
DataType:=dtPointer;
end;
end.