ForbiddenPatternDiskManager Class Reference

Forbidden pattern disk controller. More...

#include <forbiddenPatternDiskManager.hpp>

Collaboration diagram for ForbiddenPatternDiskManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ForbiddenPatternDiskManager (ForbiddenPatternManager *controller)
 Constructor.
virtual ~ForbiddenPatternDiskManager ()
 Destructor.
bool saveFPs (list< ForbiddenPattern * > FPs, wxString fileName)
 Saves a forbidden pattern collection to a file.
bool openFPs (wxString fileName)
 Opens a forbidden pattern file.

Private Member Functions

bool readFP (int width, int height, list< ForbiddenPattern * > *FPList, FlexLexer *lexer)
 Reads a forbidden pattern from a file.
void returnFPs (list< ForbiddenPattern * > *FPList)
 Asks the controller to create the patterns.
bool saveFPList (list< ForbiddenPattern * > rules)
 Private method. Saves a forbidden pattern collection to a file.
bool saveFP (ForbiddenPattern *fp)
 Saves a forbidden pattern to a file.
bool saveGrid (Grid grid)
 Saves a grid to a file.

Private Attributes

ForbiddenPatternManagercontroller
 Forbidden pattern controller.
wxTextFile file
 Text file used for writing.

Detailed Description

Forbidden pattern disk controller.

Class providing all the data persistance layer of the forbidden pattern model layer.

Author:
Bernat Rāfales Mulet <the_bell@users.sourceforge.net>
Version:
Revision
1.6

Definition at line 44 of file forbiddenPatternDiskManager.hpp.


Constructor & Destructor Documentation

ForbiddenPatternDiskManager::ForbiddenPatternDiskManager ForbiddenPatternManager controller  ) 
 

Constructor.

Parameters:
controller the forbidden pattern controller.

Definition at line 31 of file forbiddenPatternDiskManager.cpp.

References controller.

ForbiddenPatternDiskManager::~ForbiddenPatternDiskManager  )  [virtual]
 

Destructor.

Definition at line 38 of file forbiddenPatternDiskManager.cpp.


Member Function Documentation

bool ForbiddenPatternDiskManager::openFPs wxString  fileName  ) 
 

Opens a forbidden pattern file.

This method reads the patterns from the file and calls the pattern controller for creation.

Parameters:
fileName the file to be opened.
Returns:
True if the patterns were correctly opened. False otherwise.

Definition at line 177 of file forbiddenPatternDiskManager.cpp.

References NEGATION, NUMBER, readFP(), FlexLexer::switch_streams(), yyFlexLexer, FlexLexer::yylex(), and FlexLexer::YYText().

Referenced by ForbiddenPatternManager::appendFPs(), and ForbiddenPatternManager::openPFile().

Here is the call graph for this function:

bool ForbiddenPatternDiskManager::readFP int  width,
int  height,
list< ForbiddenPattern * > *  FPList,
FlexLexer lexer
[private]
 

Reads a forbidden pattern from a file.

Reads a pattern from the file and adds it to the list of the patterns already read.

Parameters:
width expected width of the pattern.
height expected height of the pattern.
FPList list of patterns where the read one has to be added.
lexer Flex lexer.
Returns:
True if the pattern was correctly read. False otherwise.

Definition at line 273 of file forbiddenPatternDiskManager.cpp.

References ForbiddenPattern::cellChanged(), nDISABLED, nENABLED, NUMBER, FlexLexer::yylex(), and FlexLexer::YYText().

Referenced by openFPs().

Here is the call graph for this function:

void ForbiddenPatternDiskManager::returnFPs list< ForbiddenPattern * > *  FPList  )  [private]
 

Asks the controller to create the patterns.

It takes a list of forbidden patterns read from a file and asks the pattern controller to add them to the collection.

Parameters:
FPList list of patterns to be added.

Definition at line 330 of file forbiddenPatternDiskManager.cpp.

References controller, and ForbiddenPatternManager::newFP().

Here is the call graph for this function:

bool ForbiddenPatternDiskManager::saveFP ForbiddenPattern fp  )  [private]
 

Saves a forbidden pattern to a file.

Parameters:
fp the forbidden pattern to be saved.
Returns:
True if the pattern was correctly saved. False otherwise.

Definition at line 102 of file forbiddenPatternDiskManager.cpp.

References file, ForbiddenPattern::getGrid(), ForbiddenPattern::getHeight(), ForbiddenPattern::getWidth(), and saveGrid().

Referenced by saveFPList().

Here is the call graph for this function:

bool ForbiddenPatternDiskManager::saveFPList list< ForbiddenPattern * >  FPs  )  [private]
 

Private method. Saves a forbidden pattern collection to a file.

Parameters:
FPs the forbidden pattern collection.
Returns:
True if the file was correctly saved. False otherwise.

Definition at line 79 of file forbiddenPatternDiskManager.cpp.

References file, and saveFP().

Referenced by saveFPs().

Here is the call graph for this function:

bool ForbiddenPatternDiskManager::saveFPs list< ForbiddenPattern * >  FPs,
wxString  fileName
 

Saves a forbidden pattern collection to a file.

Parameters:
FPs the forbidden pattern collection.
fileName the file name to be saved.
Returns:
True if the file was correctly saved. False otherwise.

Definition at line 49 of file forbiddenPatternDiskManager.cpp.

References file, and saveFPList().

Referenced by ForbiddenPatternManager::saveFile().

Here is the call graph for this function:

bool ForbiddenPatternDiskManager::saveGrid Grid  grid  )  [private]
 

Saves a grid to a file.

Parameters:
grid the grid to be saved.
Returns:
True if the grid was correctly saved. False otherwise.

Definition at line 118 of file forbiddenPatternDiskManager.cpp.

References CELL_SPACE, Grid::getHeight(), Grid::getWidth(), line, nDISABLED, nDONTCARE, and nENABLED.

Referenced by saveFP().

Here is the call graph for this function:


Member Data Documentation

ForbiddenPatternManager* ForbiddenPatternDiskManager::controller [private]
 

Forbidden pattern controller.

Definition at line 54 of file forbiddenPatternDiskManager.hpp.

Referenced by ForbiddenPatternDiskManager(), and returnFPs().

wxTextFile ForbiddenPatternDiskManager::file [private]
 

Text file used for writing.

Definition at line 56 of file forbiddenPatternDiskManager.hpp.

Referenced by saveFP(), saveFPList(), and saveFPs().


The documentation for this class was generated from the following files:
Generated on Fri Sep 1 23:56:51 2006 for NanoComp by  doxygen 1.4.6