KoMo2  1.0.0
A modern ARM emulator GUI.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CompileLoadModel Class Reference

the class definition of the compileLoadModel class, a data model which encapsulates any statefullness and logical operations associated with the compile and loading section of the KoMo2 GUI. This Model is in keeping with the MVC design pattern, with this class is the Model, the file display Label is the View, and the compiling and file browsing buttons are the Controller. More...

#include <CompileLoadModel.h>

Inheritance diagram for CompileLoadModel:
Model

Public Member Functions

 CompileLoadModel (CompileLoadView *const view, KoMo2Model *const parent)
 Construct a new CompileLoadModel::CompileLoadModel object. More...
 
virtual void changeJimulatorState (const JimulatorState newState) override
 Handles a change in JimulatorState for this model. More...
 
virtual const bool handleKeyPress (const GdkEventKey *const e) override
 Handles a key press event for this model. More...
 

Private Member Functions

const CompileLoadInnerState getInnerState () const
 Get the Inner State object. More...
 
void setInnerState (const CompileLoadInnerState newState)
 Handles changing the inner state of this model (whether a file is selected or not) More...
 
const std::string getAbsolutePathToSelectedFile () const
 Gets the absolutePathToSelectedFile member variable. More...
 
void setAbsolutePathToSelectedFile (const std::string val)
 Sets the absolutePathToSelectedFile member variable. More...
 
void onBrowseClick ()
 Opens a file selection dialog upon the BrowseButtonView being clicked.
 
void onCompileLoadClick () const
 Compiles a .s file into a .kmd file: Forks a child process, executes aasm on the child, and then load it into Jimulator, if a valid file path is given.
 
const std::string makeKmdPath (const std::string absolutePath) const
 Takes an ARM assembly file, removes it's current s extension, and appends kmd. For example, /home/user/demo.s will return home/user/demo.kmd. More...
 
void handleResultFromFileBrowser (const int result, const Gtk::FileChooserDialog *const dialog)
 Handles the result of the file browser dialog box being closed. More...
 
 CompileLoadModel (const CompileLoadModel &)=delete
 
 CompileLoadModel (const CompileLoadModel &&)=delete
 
CompileLoadModeloperator= (const CompileLoadModel &)=delete
 
CompileLoadModeloperator= (const CompileLoadModel &&)=delete
 
- Private Member Functions inherited from Model
 Model (KoMo2Model *const parent)
 Constructs a new Model object - just assigns the parent variable. More...
 
KoMo2Model *const getParent () const
 Returns the parent pointer. More...
 
template<class T1 , class T2 >
void setButtonListener (Gtk::Button *const button, const T1 b, const T2 c)
 Connect any button to any member function of. More...
 
void setButtonState (Gtk::Button *const button, const bool state, Gtk::Image *const img=nullptr, const std::string newTooltip="", const std::string newLabelText="") const
 Sets the state of a button to some boolean - the assumption is that if a button is not meant to be sensitive (get_sensitive() == false) then it should also not have a tooltip or many other attributes. You can also optionally update the buttons image, tooltip text, and label text. More...
 
JimulatorState getJimulatorState () const
 Return the jimulatorState member object. More...
 

Private Attributes

CompileLoadView *const view
 A pointer to the view that this model represents.
 
CompileLoadInnerState innerState
 Stores the state of the compile and load section of the GUI.
 
std::string absolutePathToSelectedFile
 State - stores the value of the absolute file path to a .s file, as chosen by the file browser component.
 

Detailed Description

the class definition of the compileLoadModel class, a data model which encapsulates any statefullness and logical operations associated with the compile and loading section of the KoMo2 GUI. This Model is in keeping with the MVC design pattern, with this class is the Model, the file display Label is the View, and the compiling and file browsing buttons are the Controller.

Definition at line 32 of file CompileLoadModel.h.

Constructor & Destructor Documentation

CompileLoadModel::CompileLoadModel ( CompileLoadView *const  view,
KoMo2Model *const  parent 
)

Construct a new CompileLoadModel::CompileLoadModel object.

Parameters
viewA pointer to the accompanying view object.
parentA pointer to the parent model object.

Definition at line 24 of file CompileLoadModel.cpp.

Member Function Documentation

void CompileLoadModel::changeJimulatorState ( const JimulatorState  newState)
overridevirtual

Handles a change in JimulatorState for this model.

Parameters
newStateThe state that has been changed into.

Implements Model.

Definition at line 161 of file CompileLoadModel.cpp.

const std::string CompileLoadModel::getAbsolutePathToSelectedFile ( ) const
private

Gets the absolutePathToSelectedFile member variable.

Returns
std::string The absolutePathToSelectedFile member variable.

Definition at line 278 of file CompileLoadModel.cpp.

const CompileLoadInnerState CompileLoadModel::getInnerState ( ) const
private

Get the Inner State object.

Returns
CompileLoadInnerState

Definition at line 285 of file CompileLoadModel.cpp.

const bool CompileLoadModel::handleKeyPress ( const GdkEventKey *const  e)
overridevirtual

Handles a key press event for this model.

Parameters
eThe key press event in question.
Returns
bool was the key pressed or not?

Implements Model.

Definition at line 204 of file CompileLoadModel.cpp.

void CompileLoadModel::handleResultFromFileBrowser ( const int  result,
const Gtk::FileChooserDialog *const  dialog 
)
private

Handles the result of the file browser dialog box being closed.

Parameters
resultThe result of the file browser closing (i.e. was a file selected, was the dialog box cancelled, did something unexpected happen, etc.)
dialogA pointer to the dialog box itself - frees itself in its destructor.

Definition at line 119 of file CompileLoadModel.cpp.

const std::string CompileLoadModel::makeKmdPath ( const std::string  absolutePath) const
private

Takes an ARM assembly file, removes it's current s extension, and appends kmd. For example, /home/user/demo.s will return home/user/demo.kmd.

Parameters
absolutePathThe absolute path to the .s program.
Returns
std::string The absolute path with just the file name.

Definition at line 152 of file CompileLoadModel.cpp.

void CompileLoadModel::setAbsolutePathToSelectedFile ( const std::string  val)
private

Sets the absolutePathToSelectedFile member variable.

Parameters
valThe value to set the absolutePathToSelectedFile member to.

Definition at line 271 of file CompileLoadModel.cpp.

void CompileLoadModel::setInnerState ( const CompileLoadInnerState  val)
private

Handles changing the inner state of this model (whether a file is selected or not)

Parameters
valThe value to set the inner state to.

Definition at line 241 of file CompileLoadModel.cpp.


The documentation for this class was generated from the following files: