KeyDef Class Reference

List of all members.

Public Member Functions

 __construct ()
 Construct a keydef.
 addAttrib ($name)
 Adds the named attribute to the KeyDef.
 containsAttrib ($name)
 Determines if the KeyDef contains the requested Attribute.
 getAttrib ($pos)
 getAttrib is 1 based.
 size ()
 Returns number of columns in KeyDef.

Private Attributes

 $cols
 $size
 Number of columns.


Detailed Description

Definition at line 60 of file KeyDef.php.


Constructor & Destructor Documentation

KeyDef::__construct (  ) 

Construct a keydef.

Accepts a variable number of arguments -- a list of coluns to use for keydef: $kd = new KeyDef('id'); // id col is pkey $kd = new KeyDef('key1', 'key2'); // multi-col pkey

Definition at line 78 of file KeyDef.php.

References size().

00079     {
00080         $this->cols = func_get_args();
00081         $this->size = count($this->cols);
00082     }


Member Function Documentation

KeyDef::addAttrib ( name  ) 

Adds the named attribute to the KeyDef.

Parameters:
string $name
Returns:
KeyDef The modified class.

Definition at line 89 of file KeyDef.php.

References size().

00090     {
00091         $this->cols[] = $name;
00092         $this->size++;
00093         return $this;
00094     }

KeyDef::containsAttrib ( name  ) 

Determines if the KeyDef contains the requested Attribute.

Parameters:
string $name
Returns:
boolean True if the attribute has been defined. false otherwise.

Definition at line 101 of file KeyDef.php.

00102     {
00103         return in_array($name, $this->cols, true);
00104     }

KeyDef::getAttrib ( pos  ) 

getAttrib is 1 based.

Setting pos to 0 will attempt to return pos 1.

Parameters:
int $pos 1-based position of attrib.
Returns:
string Value of attribute at pos as String. null if value is not found.

Definition at line 111 of file KeyDef.php.

00112     {
00113         if ($pos === 0) $pos = 1;
00114         return @$this->cols[$pos - 1];
00115     }

KeyDef::size (  ) 

Returns number of columns in KeyDef.

Returns:
int The number of elements in the KeyDef that were set by addAttrib()
See also:
addAttrib()

Definition at line 122 of file KeyDef.php.

Referenced by __construct(), and addAttrib().

00123     {
00124         return $this->size;
00125     }


Member Data Documentation

KeyDef::$cols [private]

Definition at line 63 of file KeyDef.php.

KeyDef::$size [private]

Number of columns.

Definition at line 66 of file KeyDef.php.


The documentation for this class was generated from the following file:

Generated on Wed May 6 23:10:49 2009 for fareofficelib by  doxygen 1.5.8