View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Incubator Proposal Zone Template With Tracker}

{zone-data:jira-key}LPPERM{zone-data}
{zone-data:jira-pid}10013{zone-data}
{zone-data:jira-recently}
{jiraissues:url=http://framework.zend.com/issues/secure/IssueNavigator.jspa?view=rss&created%3Aprevious=-1w&pid=10013&sorter/field=created&sorter/order=DESC&tempMax=25&reset=true&decorator=none|columns=Type;Key;Summary;Assignee;Priority;Status;Created}
{zone-data}
{zone-data:jira-summary}
{jiraportlet:url=http://framework.zend.com/issues/secure/RunPortlet.jspa?portletKey=com.atlassian.jira.plugin.system.portlets:project&projectid=10013&projectinfo=full}
{zone-data}
{zone-data:review-end}June 30, 2006{zone-data}


{zone-data:component-name}
Zend_Bitfield
{zone-data}

{zone-data:proposer-list}
[Richard Thomas|mailto:lists@cyberlot.net]
{zone-data}

{zone-data:revision}
0.1 - 16 June 2006: Initial Proposal.
{zone-data}

{zone-data:overview}
Zend_Bitfield is a simple bit flag manager that allows easy handling of flags for settings, storage and permissions
{zone-data}
{zone-data:references}
* In progress
{zone-data}

{zone-data:requirements}
* Provide support for 32bit, GMP and a fake "64bit" system
* Provide both database and direct input for configuration
{zone-data}

{zone-data:dependencies}
* Zend_Exception
{zone-data}

{zone-data:operation}
The idea behind Zend_Bitfield is to provide an easy method to create, access and compare bit values.
{zone-data}

{zone-data:milestones}
* In progress
{zone-data}

{zone-data:class-list}
* Zend_Bitfield_Exception
* Zend_Bitfield_initBitfield
* Zend_Bitfield
* Zend_checkBit
* Zend_createBit
* Zend_getBits
* Zend_loadBits
* Zend_Bitfield_32bit
* Zend_Bitfield_64bit
* Zend_Bitfield_GMP
* Zend_compareBit
{zone-data}

{zone-data:use-cases}
Setting up your bitfields
{code}
<?php
require_once('Zend_Bitfield.php');
Zend_Bitfield::initBitfield();
$security = array();
$security['admin'] = Zend_Bitfield::createBit('admin');
$security['moderator'] = Zend_Bitfield::createBit('moderator');
$security['user'] = Zend_Bitfield::createBit('user');
$security['banned'] = Zend_Bitfield::createBit('banned');

Zend_Bitfield::initBitfield('32bit','testgroup');
$test = array();
$test['group1'] = Zend_Bitfield::createBit('group1', 'testgroup');
$test['group2'] = Zend_Bitfield::createBit('group2', 'testgroup');


Zend_Bitfield::initBitfield('32bit','loadedin');
Zend_Bitfield::loadBits($security, 'loadedin');
$loadedin = Zend_Bitfield::getBits('loadedin');
$loadedin['addedon'] = Zend_Bitfield::createBit('addedon');

print_r($security);
print_r($test);
print_r($loadedin);
echo 'Is the number 8 a banned bit '.Zend_Bitfield::checkBit('banned', 8)."\n";
?>

{code}

{zone-data}

{zone-data:skeletons}
{code}

class Zend_Bitfield {
static protected $bitMethods = array('32bit', '64bit', 'GMP');
static protected $bitClass;
static public function initBitfield($method = '32bit', $group = 'default')
static public function checkBit($key, $value, $group = 'default')
static public function createBit($key, $group = 'default')
static public function getBits($group = 'default')
static public function loadBits($input, $group = 'default')
static public function throwException($msg)
}

class Zend_Bitfield_32bit {
private $_bitmap = array();
private $_curbit = 1;
function createBit($key)
function loadBits($bits)
function compareBit($key, $value)


}

{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>