PASRODOMCS

RAD Delphi runtime optimiser and Control Store
passrodomcs, pasrodomcs, pasrodomc, pasrodoms, pasrocs, drocs

Other versions

Code for this port has not been designed, tested, or completed

.pas

(*
 *  @AUTHOR : Jason Robinson
 *  @TITLE : AppCatch
 *  @VERSION : 0.0.0.3
 *  @RELEASE : alpha
 *  @COPYRIGHT : (C)2010. All rights reserved.
 *  @LICENSE : http://www.KitchenPages.com/library/i3/license
 *  @TODO : build / design / run / bug fixing / testing
 *)
unit pasappcatche;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, AnsiStrings, StrUtils;

{**
 *  <author>Jason Robinson</author><version>0.0.0.2</version>
 *}
type
  Tappcatche = class(TForm)
    appcatcheformta: TRichEdit;
	procedure appcatche__createform_EVENT(Sender: TObject); virtual;

(* @FUNCTION : appcatche.catchstore
 *  @VALUE : String
 *  Creates Sender value/s within store
 *)
 	procedure appcatche__catchstore( appcatchelinestoStore: string; Sender: TObject); virtual;

(* @FUNCTION : appcatche.catchstoren
 *  Creates a new store for the Sender
 *  @SEE : appcatche.catchstore
 *)
	procedure appcatche__catchstoren( appcatchelinetoStore: string; Sender: TObject); virtual;

(* @FUNCTION : appcatche.catchstored
 *  Closes a new store for the Sender
 *)
	procedure appcatche__catchstored(Sender: TObject); virtual;

(* @FUNCTION : appcatche.ifstr
 *  @VALUE : String
 *  @RETURNS : bool
 *  Searchs stores, and if found returns a value of true as bool to Sender
 *)
	function appcatche__ifstr( appcatchelinetoFind: string; Sender: TObject): Boolean;

(* @FUNCTION : appcatche.exestr
 *  @VALUE : String
 *  @RETURNS : String
 *  Searchs for store and returns matching value/s as String to Sender
 *)
	function appcatche__exestr( appcatchelinestoFind: string; Sender: TObject): string;

(* @FUNCTION : appcatche.clearstore
 *  Clears all identification and value/s within store
 *)
	procedure appcatche__clearstore(Sender: TObject); virtual;

(* @FUNCTION : appcatche.usestore
 *  @VALUE : bool
 *  Set store mode to true or false for allowing this kind of mode change override; Store mode should always be set to true
 *  @VALUE : bool
 *  Set store funciton appcatche.ifstr return bool as override to always be true or false
 *  @SEE : appcatche.ifstr
 *)
	procedure appcatche__userstore( appcatcheOnOff, appcatcheAutoIFset: Boolean; Sender: TObject); virtual;

  private
    { Private declarations }
  public
    { Public declarations }
	// appcatcheDebug: bool;
	appcatcheAuto: Boolean;
	appcatcheAutoIF: Boolean;
(*  @VALUE : appcatche.catchstr
 *  @TYPE : String
 *  store resource identification String
 *)
	appcatche__catchstr: string;
	// Demo testing only
	testvalue: AnsiString;
  end;

var
  appcatche: Tappcatche;

implementation

{$R *.dfm}

procedure Tappcatche.appcatche__createform_EVENT(Sender: TObject);
begin
(* @NOTICE : this function was Tappcatche::form_oncreate(TObject *Sender)
 *  @VALUE : appcatche.catchstr
 *  @TYPE : String
 *  store resource identification String
 *)
	appcatcheAuto := false;
	appcatcheAutoIF := true;
	appcatche__catchstr := ''; // this function can be skipped as the function Sender will set the value
(*	// --------------pretend start of function
	// perform demo one
	 testvalue := '2010';
	// --------------store starts
	{ catche return starts }
	 appcatche__catchstr := 'appcatche__createform_EVENT(self)[kpdsquare]';
	if(appcatche__ifstr(appcatche__catchstr,application)=false) then
	begin
	appcatche__catchstoren(appcatche__catchstr,self);
	{ catche return ends }
	// --------------store line
	// catche return starts }
	appcatche__catchstore('testvalue := ''' + testvalue + ''';', self);
	{ catche return ends }
	// --------------store ends
	{ catche return starts }
	appcatche__catchstored(self);
	end
	else
	appcatche__exestr(appcatche__catchstr,self);
	{catche return ends}
	// --------------end of function
*)
end;

(* @FUNCTION : appcatche.catchstore
 *  @VALUE : String
 *  Creates Sender value/s within store
 *)
procedure Tappcatche.appcatche__catchstore( appcatchelinestoStore: string; Sender: TObject);
begin
	appcatcheformta.Lines.Text := Trim(appcatcheformta.Lines.Text) + ''#13''#10'' + appcatchelinestoStore;
end;

(* @FUNCTION : appcatche.catchstoren
 *  Creates a new store for the Sender
 *  @SEE : appcatche.catchstore
 *  @REQUIRES : AnsiStrings
 *)
procedure Tappcatche.appcatche__catchstoren( appcatchelinetoStore: string; Sender: TObject);
begin
	AnsiReplaceText(''#13'', appcatchelinetoStore, appcatchelinetoStore);
	AnsiReplaceText(''#10'', appcatchelinetoStore, appcatchelinetoStore);
	appcatcheformta.Lines.Text := Trim(appcatcheformta.Lines.Text) + appcatchelinetoStore;
end;

(* @FUNCTION : appcatche.catchstored
 *  Closes a new store for the Sender
 *)
procedure Tappcatche.appcatche__catchstored(Sender: TObject);
begin
	appcatcheformta.Lines.Text := Trim(appcatcheformta.Lines.Text) + '---appcatched---'#13''#10'';
end;

(* @FUNCTION : appcatche.ifstr
 *  @VALUE : String
 *  @RETURNS : bool
 *  Searchs stores, and if found returns a value of true as bool to Sender
 *  @REQUIRES : AnsiStrings
 *)
function Tappcatche.appcatche__ifstr( appcatchelinetoFind: string; Sender: TObject): Boolean;
var appcatcheStatus : Boolean;
begin
	appcatcheStatus := false;
	if (appcatcheAuto = true) then begin
		appcatcheStatus := appcatcheAutoIF;
	end
	else
		if (appcatcheformta.Lines.IndexOf(appcatchelinetoFind) <> -1) then begin
			appcatcheStatus := true;
		end;
	Result := appcatcheStatus;
end;

(* @FUNCTION : appcatche.exestr
 *  @VALUE : String
 *  @RETURNS : String
 *  Searchs for store and returns matching value/s as String to Sender
 *  @REQUIRES : AnsiStrings, StrUtils
 *)
function Tappcatche.appcatche__exestr( appcatchelinestoFind: string; Sender: TObject): string;
var appcatcheESTR : AnsiString;
var foundatESTR : Integer;
begin
	appcatcheESTR := appcatcheformta.Lines.ToString;
	foundatESTR := AnsiPos(appcatcheESTR, appcatchelinestoFind + AnsiString(''#13''#10'')) + Length(appcatchelinestoFind);
	appcatcheESTR := RightStr(appcatcheESTR, foundatESTR );
	appcatcheESTR := LeftStr(appcatcheESTR, AnsiPos(appcatcheESTR, '---appcatched---'));
	Result := appcatcheESTR;
end;

(* @FUNCTION : appcatche.clearstore
 *  Clears all identification and value/s within store
 *)
procedure Tappcatche.appcatche__clearstore(Sender: TObject);
begin
	appcatche__catchstr := '';
	appcatcheformta.Lines.Text := '';
end;

(* @FUNCTION : appcatche.usestore
 *  @VALUE : bool
 *  Set store mode to true or false for allowing this kind of mode change override; Store mode should always be set to true
 *  @VALUE : bool
 *  Set store funciton appcatche.ifstr return bool as override to always be true or false
 *  @SEE : appcatche.ifstr
 *)
procedure Tappcatche.appcatche__userstore( appcatcheOnOff, appcatcheAutoIFset: Boolean; Sender: TObject);
begin
	appcatcheAuto := appcatcheOnOff;
	appcatcheAutoIF := appcatcheAutoIFset;
end;

{eof}
end.



No pascal use example is provided at this time.

Other versions


©Copyright 2010. Rights reserved