Model View Controller: Difference between revisions

From Bitpost wiki
(Created page with "C++11 Model View Controller skeleton Three objects contain most of the functionality. In addition, utilities.* provides crosscut features like global logging. '''CONTROLLER...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
C++11 Model View Controller skeleton
{| class="mw-collapsible mw-collapsed wikitable"
 
! C++11 MVC skeleton
Three objects contain most of the functionality.  In addition, utilities.* provides crosscut features like global logging.
|-
| Three objects contain most of the functionality.  In addition, utilities.* provides crosscut features like global logging.


'''CONTROLLER header'''
'''CONTROLLER header'''
Line 28: Line 29:
  {
  {
     HTDJLocalModel();
     HTDJLocalModel();
|}
{| class="mw-collapsible mw-collapsed wikitable"
! HTML+CSS+JS as MVC
|-
| "Use as the wonderful MVC structure they are", heh
# HTML is your Model, containing your data
# CSS is your View, defining how the page should look
# JS is your Controller, controlling how the model and view interact.
|}

Latest revision as of 13:52, 1 April 2016

C++11 MVC skeleton
Three objects contain most of the functionality. In addition, utilities.* provides crosscut features like global logging.

CONTROLLER header

#include "HTDJInterface.h"
#include "HTDJLocalModel.h"
#include "HTDJRemoteModel.h"

class HTDJController
    HTDJController(
        HTDJLocalModel& local,
        HTDJRemoteModel& remote,
        HTDJInterface& hinterface

VIEW header

class HTDJController;
class HTDJInterface
{
   HTDJInterface( HTDJController* p_controller)

MODEL header

class HTDJLocalModel;

// Note that we want GLOBAL ACCESS to a GENERIC local model.
extern HTDJLocalModel* g_p_local;
class HTDJLocalModel
{
    HTDJLocalModel();
HTML+CSS+JS as MVC
"Use as the wonderful MVC structure they are", heh
  1. HTML is your Model, containing your data
  2. CSS is your View, defining how the page should look
  3. JS is your Controller, controlling how the model and view interact.