c2ephp

COB Class Reference

Class that interacts with COB files (c1 and c2 formats) More...

List of all members.

Public Member Functions

 COB (IReader $reader=null)
 Creates a new COB file.
 LoadC2COB (IReader $reader)
 Loads a C2 COB from the IReader given.
 LoadC1COB (IReader $reader)
 Loads a C1 COB from the specified reader.
 AddBlock (COBBlock $block)
 Adds a COBBlock to this COB.
 GetBlocks ($type=false)
 Accessor method to get blocks of the given type.
 Compile ($format=null)
 Compiles the COB in the given format.
 CompileC1 ()
 Compiles to a C1 COB. Unimplemented
 CompileC2 ()
 Compiles a C2 COB. May not actually work.

Detailed Description

Class that interacts with COB files (c1 and c2 formats)

Definition at line 23 of file COB.php.


Member Function Documentation

COB::AddBlock ( COBBlock block)

Adds a COBBlock to this COB.

Parameters:
$blockthe block to add.

Definition at line 114 of file COB.php.

COB::COB ( IReader reader = null)

Creates a new COB file.

If you want to create a COB file from scratch, simply don't pass anything to the constructor.

Alternatively, if you know which kind of COB file you are reading, or only want to deal with a specific kind of COB file, you can call the LoadC1COB and LoadC2COB functions after creating a blank cob file. E.g. ($reader is a IReader)

$cob = new COB;
$cob->LoadC1COB($reader);
This code will only parse C1 cobs.

Parameters:
$readerThe reader which contains the cob to read from. Can be null.

Definition at line 45 of file COB.php.

COB::Compile ( format = null)

Compiles the COB in the given format.

Parameters:
$formatThe format of the COB. If null, assumed it's a creatures 2 COB
Returns:
A binary string containing the COB.

Definition at line 175 of file COB.php.

COB::CompileC1 ( )

Compiles to a C1 COB. Unimplemented

Definition at line 194 of file COB.php.

COB::CompileC2 ( )

Compiles a C2 COB. May not actually work.

Definition at line 199 of file COB.php.

COB::GetBlocks ( type = false)

Accessor method to get blocks of the given type.

If $type is false, will return all blocks in this agent.
In a C1 COB, there is only one block and it is of the agnt type.

Parameters:
$typeThe type of block to get (agnt, auth, file). False by default.
Returns:
An array of COBBlocks.

Definition at line 160 of file COB.php.

COB::LoadC1COB ( IReader reader)

Loads a C1 COB from the specified reader.

C1 COBs have just one block, which is a COBAgentBlock. This is accessible by calling COB::GetBlocks

Parameters:
$readerthe reader to load from

Definition at line 101 of file COB.php.

COB::LoadC2COB ( IReader reader)

Loads a C2 COB from the IReader given.

C2 COBs have multiple blocks, which are accessible via the COB::GetBlocks function.

Parameters:
$readerThe IReader to load from

Definition at line 84 of file COB.php.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations