C++ Demo Projects
The layouts of C++ samples are profiled in workspaces \samples\cpp\Demo[1-4].vpw. Open them by "File / Open" command.
\samples\cpp\Example1.vpp
- Demo1: Hello C++ World - the most simple console application
- how to organizes a traditional make process (see folder Make from "Medium / Files")
- how to write makefiles for different compilers (f.e MS Visual C++ and EGCS-Mingw32)
- MakeFile includes dependences VpxCpp.dep generated by VPA
- consists of the single file Main.c which does not depend upon another files
- how to include directives in files (see the item Main.c which contains #include <stdio.h>)
- both the declarations and bodies of section Work are deployed into Main.c
- Main.c in its turn mirrors two links: <Link(H)>:Work for declarations and <Link(C)>:Work for bodies
\samples\cpp\Example2.vpp
- Demo2: Windows Application - the most simple Windows application
- how to deploy declarations and bodies into different files (see properties of group Main)
- store of Windows resources in two forms: char[] array and standard RC file
- consists of several files which depend upon one another
- use of numerators to generate sequential values of constants (see IDS Enumerator for string table)
\samples\cpp\Example3.vpp
- Demo3: GUI Design - introduction to user interface builder
- RC (resource) and CWS (create window structure) paradigms of GUI
- class ADialogue as wrapper for dialog as Windows resource
- class AForm as wrapper for interactive form created through CWS
\samples\cpp\Example4.vpp
- Demo4: Use of Lib TcWinApp - demonstrates how to design composite GUI
- use of class MyProgram derived from TC_CProgram
- use of class MyMainWindow derived from TC_CWindow and TC_CEventMaster
- event-driven technique in practice
- set Ev_Create handler for the "create window event" in constructor of MyMainWindow
- set bulk of handlers in MyMainWindow::Ev_Create
- use of special method MenuMaker
- items of MenuMaker as event handlers
- how to design toolbar using class TC_CToolbarMaster, method ToolbarMaker and event handler Ev_ToolbarCmd
- how virtual method Form_Creator may be overriden
- design of visual component as C++ class (see class MyComponent1 and its further use in class MyForm2)
\samples\cpp\Example5.vpp
- Demo5: Hello Persistence World - acquaintance with Persistence Smith in console application
- design of small Object Model (Object Model consists of single persistent class PsPerson)
- how to create database by means of generated SQL DDL script (press Num5 or F4 while positioning at the item "Demo5: Hello Persistent World")
- use of persistent data driver and data service (see function main)
- connection to database by means of data driver
- transactional workspace (it is created by call of TC_PSMITH->TxBegin and destroyed by TC_PSMITH->TxCommit or TC_PSMITH->TxRollback)
- how to build and execute object query (see use of classes TC_CPsPredicate and TC_CPsSort, call of TC_PSMITH->ExecQuery)
- how to fetch objects from result set (through instance of parameterized class TC_TPsCursor<PsPerson>)
- implementation of object i/o (see TC_TPsRef<PsPerson>, TC_PSMITH->RestoreObject, obj->Store)
- exception handling technique in practice (see use of function ExceptionMessage and call of TC_PSMITH->TxRollback in catch block)
\samples\cpp\Example6.vpp
- Demo6: Simple Trade System - shows all Peristence Smith's features
- unified modeling by means of persistent class diagram (invoke it by Ctrl+F11)
- persistent inheritance (e.g. both PsInvoice and PsPayment from PsBizOper)
- object associations of all kinds (one-to-one PsProduct-PsMeasure, one-to-many PsProdCtg-PsProduct)
- sorted and unsorted persistent collections (see "PS Collection" of classes PsProdCtg, PsProduct)
- navigation through object model (e.g. PsProduct::Get_Ctg, PsInvoice::Get_InvItems)
- programming of database business logic using conmmon C++ (see "Transient Section" of classes PsBizOper, PsInvoice and PsInvItem)
- use of class library Persistent Forms (see project tcPsForm.vpp)
- user interface automation through GUI components (inspect the whole group Forms)
- complex object queries (see class TC_CPfQuery from tcPsForm.vpp, its use as component in almost all forms)
- design of report templates (run Report Designer and load files *.rp3 from \build\cpp\Demo6 folder)
- use of Report Client to interact with templtes and organize printing job (see library tcReport.vpp)
- invocation of run-time GUI designer (see TC_CPfClass::EvDesigner from project tcPsForm.vpp)