phing-system-util
[ class tree: phing-system-util ] [ index: phing-system-util ] [ all elements ]

Class: Register

Source Location: /system/util/Register.php

Class Overview


Static class to handle a slot-listening system.


Author(s):

Version:

  • $Revision: 526 $

Methods



Class Details

[line 41]
Static class to handle a slot-listening system.

Unlike the slots/signals Qt model, this class manages something that is more like a simple hashtable, where each slot has only one value. For that reason "Registers" makes more sense, the reference being to CPU registers.

This could be used for anything, but it's been built for a pretty specific phing need, and that is to allow access to dynamic values that are set by logic that is not represented in a build file. For exampe, we need a system for getting the current resource (file) that is being processed by a filterchain in a fileset.

Each slot corresponds to only one read-only, dynamic-value RegisterSlot object. In a build.xml register slots are expressed using a syntax similar to variables:

<replaceregexp> <regexp pattern="\n" replace="%{task.current_file}"/> </replaceregexp>

The task/type must provide a supporting setter for the attribute:

  1.      function setListeningReplace(RegisterSlot $slot{
  2.         $this->replace $slot;
  3.   }
  4.  
  5.   // in main()
  6.   if ($this->replace instanceof RegisterSlot{
  7.         $this->regexp->setReplace($this->replace->getValue());
  8.   else {
  9.         $this->regexp->setReplace($this->replace);
  10.   }




Tags:

author:  Hans Lellelid <hans@xmpl.org>
version:  $Revision: 526 $


[ Top ]


Class Methods


static method getSlot [line 54]

static RegisterSlot getSlot( string $key)

Returns RegisterSlot for specified key.

If not slot exists a new one is created for key.




Tags:

access:  public


Parameters:

string   $key  

[ Top ]


Documentation generated on Mon, 19 Oct 2009 10:51:53 +0200 by phpDocumentor 1.4.3