Sitellite Application Framework
Class Tree         Index         All Elements

Class: Buffer

Source Location: Program_Root/Parser/Buffer.php

Class Overview


Buffer implements string, array, and tree structure buffering for classes extending saf.Parser. This makes management of cumulative data easier during the analysis of a big ugly pile of tokens.


Author(s)

Version

  • 0.8, 2003-01-20, $Id: Buffer.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 62]
Buffer implements string, array, and tree structure buffering for classes extending saf.Parser. This makes management of cumulative data easier during the analysis of a big ugly pile of tokens.

One might call the combination of this and saf.Parser something of a Finite State Machine (FSM), but not quite. Callbacks (like transitions) are handled by saf.Parser, which would use Buffer to store data in a Push-Down Automata (PDA) like manner. The current state can be stored in a private property of the saf.Parser object.


1 <?php
2
3 $buff = new Buffer;
4
5 // sets $output to 'Foo bar'
6 $buff->set ('Foo bar');
7
8 // adds ' asdf qwerty to $output
9 $buff->append (' asdf qwerty');
10
11 // returns $output
12 echo $buff->get ();
13
14 ?>




Tags:

access:  public
version:  0.8, 2003-01-20, $Id: Buffer.php,v 1.2 2005/07/06 15:30:56 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$buffers = array ()

[line 79]

The array buffer.



Tags:

access:  public

Type:   mixed


[ Top ]

$output =  ''

[line 71]

The string buffer.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


method append [line 126]

mixed append( string $name, [mixed $data = false])

Appends to a buffer value. Same rules as set() apply

as to how the parameters are interpreted (this applies to all methods here), and what is returned. Note: On unnamed arrays, append() appends the value to the end of the array, and not to the end of the last element in the array.




Tags:

access:  public


Parameters:

string   $name  
mixed   $data  

[ Top ]

method clear [line 174]

void clear( [mixed $name = false])

Clears a buffer value.



Tags:

access:  public


Parameters:

mixed   $name  

[ Top ]

method get [line 190]

mixed get( [mixed $name = false])

Retrieves the specified value from the buffers.



Tags:

access:  public


Parameters:

mixed   $name  

[ Top ]

method getAll [line 205]

array getAll( )

Returns the entire $buffers array.



Tags:

access:  public


[ Top ]

method prepend [line 152]

mixed prepend( string $name, [mixed $data = false])

Preppends to a buffer value. Note: On unnamed arrays, append() appends the value to the end of the array, and not to the start of an element in the array.



Tags:

access:  public


Parameters:

string   $name  
mixed   $data  

[ Top ]

method set [line 98]

mixed set( string $name, [mixed $data = false])

Sets a buffer value. If only one parameter is passed, it will assume that you want it to go into the $output property.

If two are passed, it will put it into $buffers. If the first value is false, it will append it to $buffers without specifying the key. Returns true for named buffers and data sent to $output, and returns the number of the buffered data in the absense of a key.




Tags:

access:  public


Parameters:

string   $name  
mixed   $data  

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:16:50 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2