DumontEXE 0.0.1
Public Slots | Public Member Functions | Private Attributes
cmcApplication Class Reference

Commence Application object. More...

#include <cmcApplication.h>

Inheritance diagram for cmcApplication:

List of all members.

Public Slots

void activate ()
 Activate the application
.
QString applicationName ()
 Return the Application Name
.
QString backup (long index)
 Backup String
.
virtual cmcCategoryDefcategoryDef (const QString &categoryName)
 Access a specific category definition by Name
.
virtual cmcCategoryDefcategoryDef (long index)
 Access a specific category definition by Index
.
virtual cmcCategoryDefscategoryDefs ()
 Access the Category Defs collection
.
virtual cmcCdaItemcdaItem ()
 CDA Item
.
bool checkOutAllFormScripts ()
 CheckOut All Form Scripts
.
virtual long currentScriptLevel (long level=-1)
 Contains the script level set by the script
.
virtual cmcDatabasedatabase ()
 Access the Database API
.
virtual QString databaseDirectory ()
 DOS path of active Commence Database
.
virtual QString databaseName ()
 Name of the active Commence database
.
virtual long defaultScriptLevel ()
 Maximum script level
.
QString dumontCategoryName ()
 Return Dumont Category Name
.
cmcQueuegetQueue (const QString &queueName)
 Launch an Application from a queue
.
virtual QString getVersion ()
 Return the current Version of Commence
.
QString iniFilename ()
 .ini File Name

bool isClient ()
 Is Client
.
virtual bool isScriptLevelSupported ()
 Is Script Level Supported
.
bool isServer ()
 Is Server
.
virtual QString name ()
 Application name
.
virtual QString programDirectory ()
 Commence program directory
.
virtual QString programName ()
 Commence .exe file name
.
virtual bool sameDatabase ()
 TRUE if database name hasn't changed
.
long serverId ()
 Server ID
.
long sharedDbId ()
 Shared DB ID
.
long shareDefault ()
 Share Default
.
long syncFiles ()
 Sync Files
.
long syncValid ()
 Sync Valid
.
QString title ()
 Application Title
.
bool updateCommonCode ()
 Update Common Code
.
virtual QString version ()
 Return the current Version of Commence
.
long workgroupEnable ()
 data.ini Workgroup/Enable flag

long workgroupNumEntries ()
 Number of Workgroup Entries
.

Public Member Functions

 cmcApplication (IDispatch *dispatch, const QString &dumontCategoryName="Dumont", QObject *parent=NULL)

Private Attributes

QPointer< cmcTreeModelm_appModel
 Application Model
.
QPointer< cmcCategoryDefsm_categoryDefs
 Pointer to categoryDefs object
.
QPointer< cmcCdam_cda
 CDA Cache
.
QPointer< cmcDatabasem_database
 Pointer to database object
.

Detailed Description

Commence Application object.

This object represents the Commence Application wrapper object. This is the primary reference to the Commence database, when accessing anything from an external script or program. When the user registers his Commence database with the DumontROT, it is this object that actually gets registered. When the user then, later, requests a handle to one of the registered databases, he receives a pointer to this object.

All of the basic Commence Application object functions are supported transparently for software compatibility.

The following is a demonstration of using the Commence.Application object to access various properties of the Commence database, and also demonstrates how the Running Object Table (ROT) can be used to gain access to various registered databases. For detail on using the Running Object Table, refer to the cmcRot object. and also refer to the R.O.T. function call.

vbScript Example ~ Accessing the Dumont ROT
 '
 ' A vbScript example program to access more than one database.  In order for this
 '  script to run, the application must be registered in the cmcRot table.
 '
 dim dexe: set dexe = createObject("Dumont.EXE")      ' hook dumont
 dim dapp: set dapp = dexe.application("dumont_test") ' request a database by name
 
 '
 ' Print everything if possible
 '
 if( not dapp is nothing ) then
   dexe.debug "dapp.currentScriptLevel: " & dapp.currentScriptLevel
   dexe.debug "dapp.databaseDirectory:  " & dapp.databaseDirectory
   dexe.debug "dapp.databaseName:       " & dapp.databaseName
   dexe.debug "dapp.defaultScriptLevel: " & dapp.defaultScriptLevel
   dexe.debug "dapp.name:               " & dapp.name
   dexe.debug "dapp.programDirectory:   " & dapp.programDirectory
   dexe.debug "dapp.programName:        " & dapp.programName
   dexe.debug "dapp.sameDatabase:       " & dapp.sameDatabase
 end if
Application.DatabaseName.png

Definition at line 94 of file cmcApplication.h.


Constructor & Destructor Documentation

cmcApplication ( IDispatch *  dispatch,
const QString &  dumontCategoryName = "Dumont",
QObject *  parent = NULL 
)

Note:
This routine makes reference to the db object in the application. What this seems to do is properly associate a reference count to the Application object - or Commence. In this condition, if the user closes Commence, and this cmcApplication object is still in existence somewhere in another application (namely the DumontROT or an external application) then the Commence application itself will not actually close, because there is an outstanding reference to its database object. This is rather strange, because, technically we already have reference to its Application object, and given those facts, the application should already not shut down. But, Commence doesn't work this way it seems. Even incrementing (here) the AddRef() of the application object doesn't do the trick - to lock it into memory. However, if we simply make reference to the db object in Commence, then, wholla, Commence is locked, until we delete that reference to the database object. That doesn't seem right, but we are going to go with it at this point, because, since we are using this reference to the Commence application object in the DumontROT, we want to more or less permanently lock it in memory, properly, the way it should be. Once we delete this cmcApplication object, the CommenceDatabase object will be deleted along with it, and the memory and pointers and reference counts will all be properly freed up.
Note that we reference the cv object rather than just the db object. Note that there is no real fundamental differences between the two calls, except that calling cv causes the conversation to be registered, which also causes the db object to be registered as well.

Parameters:
dispatchIDispatch ~ pointer to the COM interface dispatch program.
dumontCategoryNameString ~ Dumont Category Name. Defaults to 'Dumont'. This can be overridden by the registering application.

Definition at line 50 of file cmcApplication.cpp.


Member Function Documentation

void activate ( ) [slot]

Activate the application
.

This brings the application to the foreground.

Definition at line 422 of file cmcApplication.cpp.

QString applicationName ( ) [slot]

Return the Application Name
.

The Application Name is slightly different than the databaseName() function call, or the cmcApplication::name() function call. The application name is a generic name that can be assigned to this instance of this application that is universal across the entire workgroup.

When requesting an application instance from the ROT, the specific database name in the databaseName() list can be used, the databasePath() can be used, or the applicationName() function call can be used. This allows external scripts to be written to call upon a database by this generic name rather a database name that might be unique for each client installation.

See also:
setApplicationName

Definition at line 136 of file cmcApplication.cpp.

QString backup ( long  index) [slot]

Backup String
.

Definition at line 392 of file cmcApplication.cpp.

cmcCategoryDef * categoryDef ( const QString &  categoryName) [virtual, slot]

Access a specific category definition by Name
.

Definition at line 281 of file cmcApplication.cpp.

cmcCategoryDef * categoryDef ( long  index) [virtual, slot]

Access a specific category definition by Index
.

Definition at line 288 of file cmcApplication.cpp.

cmcCategoryDefs * categoryDefs ( ) [virtual, slot]

Access the Category Defs collection
.

Definition at line 272 of file cmcApplication.cpp.

cmcCdaItem * cdaItem ( ) [virtual, slot]

CDA Item
.

Reimplemented from cmcObject.

Definition at line 128 of file cmcApplication.cpp.

bool checkOutAllFormScripts ( ) [slot]

CheckOut All Form Scripts
.

This will check out all form scripts into the database directory under the location db\Dumont.

Definition at line 472 of file cmcApplication.cpp.

long currentScriptLevel ( long  level = -1) [virtual, slot]

Contains the script level set by the script
.

To change the script level (which controls the VBScript objects supported by Commence), assign the desired level to this property. The level must be greater than 0 and less than or equal to DefaultScriptLevel

vbScriptExample
 dim dexe: set dexe = createObject("Dumont.EXE") ' fetch Dumont
 dim dapp: set dapp = dexe.app(Application)      ' wrap the Application Object
 dexe.debug "Level: " & dapp.currentScriptLevel  ' show the current level
 dapp.currentScript Level = 5                    ' change the level
 dexe.debug "Level: " & dapp.currentScriptLevel  ' show the new level
See also:
isScriptLevelSupported, defaultScriptLevel

Definition at line 143 of file cmcApplication.cpp.

cmcDatabase * database ( ) [virtual, slot]

Access the Database API
.

This returns a wrapped commence database object.

See also:
db

Definition at line 155 of file cmcApplication.cpp.

virtual QString databaseDirectory ( ) [virtual, slot]

DOS path of active Commence Database
.

ie., c:\commence\data\

virtual QString databaseName ( ) [virtual, slot]

Name of the active Commence database
.

This returns the name of the database. This is the same name that is registered in the Commence 'Open/Manage Database' dialog window. Given the example image shown, the following code will produce these results:

virtual long defaultScriptLevel ( ) [virtual, slot]

Maximum script level
.

contains the maximum script level supported by this version of Commence

QString dumontCategoryName ( ) [inline, slot]

Return Dumont Category Name
.

This returns the current value of the Dumont Category Name.

Definition at line 464 of file cmcApplication.h.

cmcQueue * getQueue ( const QString &  queueName) [slot]

Launch an Application from a queue
.

Parameters:
queueNamestring ~ name of the queue to use for the app

Definition at line 327 of file cmcApplication.cpp.

QString getVersion ( void  ) [virtual, slot]

Return the current Version of Commence
.

This function is provided for support for the Commence documentation. Note that the actual function call is wrong, according to the documentation and the actual call should be "Version" not "GetVersion". Making this call dispatches automatically to the correct "Version" call.

Definition at line 242 of file cmcApplication.cpp.

QString iniFilename ( ) [slot]

.ini File Name

Definition at line 351 of file cmcApplication.cpp.

bool isClient ( ) [slot]

Is Client
.

Returns TRUE if this application is a CLIENT database

Definition at line 382 of file cmcApplication.cpp.

bool isScriptLevelSupported ( void  ) [virtual, slot]

Is Script Level Supported
.

Definition at line 256 of file cmcApplication.cpp.

bool isServer ( void  ) [slot]

Is Server
.

Returns TRUE if this application is a SERVER database

Definition at line 377 of file cmcApplication.cpp.

virtual QString name ( ) [virtual, slot]

Application name
.

usually Commence

Reimplemented from cmcObject.

virtual QString programDirectory ( ) [virtual, slot]

Commence program directory
.

often c:\commence, but more likely C:\Program Files\Commence

virtual QString programName ( ) [virtual, slot]

Commence .exe file name
.

often c:\commence\commence.exe

bool sameDatabase ( ) [virtual, slot]

TRUE if database name hasn't changed
.

After Commence has opened, and registered itself with Dumont, it is possible for the user to open another database. That basically invalidates the Application object that initially got registered with Dumont. This function checks the name of the open database against the name of the database when the item was first registered. If it is the same, then this function returns true.

This function is used in the cmcRot::application() routines when fetching a handle to a Commence application from the running object table. If the database relative to that ROT entry has changed then the handle will be removed from the table, and an empty object pointer will be returned back to the caller.

Definition at line 263 of file cmcApplication.cpp.

long serverId ( ) [slot]

Server ID
.

Definition at line 397 of file cmcApplication.cpp.

long sharedDbId ( ) [slot]

Shared DB ID
.

Definition at line 362 of file cmcApplication.cpp.

long shareDefault ( ) [slot]

Share Default
.

Definition at line 372 of file cmcApplication.cpp.

long syncFiles ( ) [slot]

Sync Files
.

Definition at line 367 of file cmcApplication.cpp.

long syncValid ( ) [slot]

Sync Valid
.

Definition at line 402 of file cmcApplication.cpp.

QString title ( ) [slot]

Application Title
.

This indicates the application title. This is the title that is shown in the main Commence window. This value depends on the name of the database, plus the Server/Client profile.

Title Examples
 Commence/SERVER - KES.sv3
 Commence/CLIENT - KES.mwp
 Commence/SERVER - Contact Manager
 Commence - My Standalone Database

Definition at line 407 of file cmcApplication.cpp.

bool updateCommonCode ( ) [slot]

Update Common Code
.

This is a utility function that is designed to loop through entries in the Dumont category that are considered to be common code scripts, and locates them throughout the database and updates them.

Definition at line 487 of file cmcApplication.cpp.

virtual QString version ( ) [virtual, slot]

Return the current Version of Commence
.

This returns the current version of Commence.

long workgroupEnable ( ) [slot]

data.ini Workgroup/Enable flag

Definition at line 357 of file cmcApplication.cpp.

long workgroupNumEntries ( ) [slot]

Number of Workgroup Entries
.

Definition at line 387 of file cmcApplication.cpp.


Member Data Documentation

QPointer<cmcTreeModel> m_appModel [private]

Application Model
.

Definition at line 505 of file cmcApplication.h.

QPointer<cmcCategoryDefs> m_categoryDefs [private]

Pointer to categoryDefs object
.

Definition at line 498 of file cmcApplication.h.

QPointer<cmcCda> m_cda [private]

CDA Cache
.

Definition at line 486 of file cmcApplication.h.

QPointer<cmcDatabase> m_database [private]

Pointer to database object
.

Definition at line 492 of file cmcApplication.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com