Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include "FormatterInterface.h"
using namespace std;
FormatterInterface :: FormatterInterface()
{
}
FormatterInterface :: ~FormatterInterface()
{
}
// Settings
void FormatterInterface :: SetImplementor(FormatterImplementation *imp)
{
if (implementor != __null) {
imp->SetMaxWidth(implementor->GetMaxWidth());
imp->SetMaxHeight(implementor->GetMaxHeight());
int row,col;
implementor->GetCursorPosition(row,col);
imp->SetCursorPosition(row,col);
}
implementor = shared_ptr<FormatterImplementation>(imp);
}
void FormatterInterface :: SetMaxWidth(int maxWidth)
{
CheckImplementor();
implementor->SetMaxWidth(maxWidth);
}
int FormatterInterface :: GetMaxWidth()
{
CheckImplementor();
return implementor->GetMaxWidth();
}
void FormatterInterface :: SetMaxHeight(int maxHeight)
{
CheckImplementor();
implementor->SetMaxHeight(maxHeight);
}
int FormatterInterface :: GetMaxHeight()
{
CheckImplementor();
return implementor->GetMaxHeight();
}
// Render Methods
void FormatterInterface :: Build()
{
CheckImplementor();
implementor->Build();
}
int FormatterInterface :: GetRenderableLineCount()
{
CheckImplementor();
return implementor->GetRenderableLineCount();
}
shared_ptr<string> FormatterInterface :: GetLine(int x)
{
CheckImplementor();
return implementor->GetLine(x);
}
void FormatterInterface :: GetCursorPosition(int &row, int &col)
{
CheckImplementor();
implementor->GetCursorPosition(row,col);
}
void FormatterInterface :: GetPosition(int &row, int &col)
{
CheckImplementor();
implementor->GetCursorPosition(row,col);
implementor->CursorToGrid(row,col);
}
void FormatterInterface :: SetPosition(int row, int col)
{
CheckImplementor();
implementor->GridToCursor(row,col);
implementor->SetCursorPosition(row,col);
}
// Actions
void FormatterInterface :: HandleMoveLeft()
{
CheckImplementor();
implementor->HandleMoveLeft();
}
void FormatterInterface :: HandleMoveRight()
{
CheckImplementor();
implementor->HandleMoveRight();
}
void FormatterInterface :: HandleMoveUp()
{
CheckImplementor();
implementor->HandleMoveUp();
}
void FormatterInterface :: HandleMoveDown()
{
CheckImplementor();
implementor->HandleMoveDown();
}
void FormatterInterface :: HandlePageUp()
{
CheckImplementor();
implementor->HandlePageUp();
}
void FormatterInterface :: HandlePageDown()
{
CheckImplementor();
implementor->HandlePageDown();
}
void FormatterInterface :: HandleHome()
{
CheckImplementor();
implementor->HandleHome();
}
void FormatterInterface :: HandleEnd()
{
CheckImplementor();
implementor->HandleEnd();
}
// Private Methods for ViewControllerInterface
void FormatterInterface :: CheckImplementor()
{
if (implementor == __null) {
throw string("ViewControllerInterface has no implementation!");
}
}