Twain_DSM  1.0
Classes | Public Member Functions | Public Attributes | List of all members
CTwnDsmAppsImpl Class Reference

Impl Class to hold list of connected applications. More...

Collaboration diagram for CTwnDsmAppsImpl:
Collaboration graph
[legend]

Classes

struct  _pod
 We use a pod (Pieces of Data) system because it help prevents us from making dumb initialization mistakes. More...
 

Public Member Functions

 CTwnDsmAppsImpl ()
 Our CTwnDsmAppsImpl constructor.
 
int scanDSDir (char *_szAbsPath, TW_IDENTITY *_pAppId)
 Scan for Data Sources. More...
 
const char * StringFromCC (const TW_UINT16 cc)
 Translates the cc passed in into a string and returns it. More...
 
TW_INT16 LoadDS (TW_IDENTITY *_pAppId, char *_pPath, TWID_T _DsId, bool _boolKeepOpen)
 Loads a DS from disk and adds it to a global list of DS's. More...
 
void AppSetConditionCode (TW_IDENTITY *_pAppId, TW_UINT16 _ConditionCode)
 Set the condition code. More...
 

Public Attributes

struct CTwnDsmAppsImpl::_pod pod
 Pieces of data for CTwnDsmAppsImpl.
 
CAppList m_AppInfo
 list of applications.
 

Detailed Description

Impl Class to hold list of connected applications.

In 32bit enviroments each application will connect to a seperate instance of DSM data but with this list it allows ONE application to connect several time, as long as it uses a different name with each connection. I'm still not sure why you'd want to do that, but there it is. This class is intended to hide the gory details of how we're storing the data, so an impl is used.

Definition at line 240 of file apps.cpp.

Member Function Documentation

◆ AppSetConditionCode()

void CTwnDsmAppsImpl::AppSetConditionCode ( TW_IDENTITY _pAppId,
TW_UINT16  _ConditionCode 
)

Set the condition code.

Parameters
[in]_pAppIdOrigin of message
[in]_ConditionCodenew code to remember

The same rules apply here as they do for AppGetConditionCode. This is the implemenation function.

Definition at line 660 of file apps.cpp.

Referenced by CTwnDsmApps::AppSetConditionCode().

◆ LoadDS()

TW_INT16 CTwnDsmAppsImpl::LoadDS ( TW_IDENTITY _pAppId,
char *  _pPath,
TWID_T  _DsId,
bool  _boolKeepOpen 
)

Loads a DS from disk and adds it to a global list of DS's.

Load a driver.

Parameters
[in]_pAppIdOrigin of message
[in]_pPathThe path to the library to open
[in]_DsIdthe source array index
[in]_boolKeepOpenif set to true keeps DS open after successful load
Returns
a valid TWRC_xxxx return code

This is the implementation function. We use this both to browse for drivers during MSG_GETFIRST/MSG_GETNEXT and to load a specific driver during MSG_OPENDS. Which is why we need the path and the keep open flag...

Definition at line 1446 of file apps.cpp.

◆ scanDSDir()

int CTwnDsmAppsImpl::scanDSDir ( char *  _szAbsPath,
TW_IDENTITY _pAppId 
)

Scan for Data Sources.

Find all of the drivers.

Recursively navigate the TWAIN datasource dir looking for data sources. Store all valid data sources in _pList upto a maximum of MAX_NUM_DS data sources.

Parameters
[in]_szAbsPathstarting directory to begin search.
[out]_pAppIdthe application requesting scan.
Returns
either EXIT_SUCCESS or EXIT_FAILURE.

We recursively descend into the driver directory, looking for files with a .ds extension, opening them and getting their TW_IDENTITY. Which is why it's critical that drivers do as little as possible during this operation. It's easy to know when it's happening, because the application's TW_IDENTITY is empty, which is the hint that the DSM is browsing...

Definition at line 1137 of file apps.cpp.

References NCHARS, SSTRCAT, and SSTRCPY.

◆ StringFromCC()

const char * CTwnDsmAppsImpl::StringFromCC ( const TW_UINT16  cc)

Translates the cc passed in into a string and returns it.

Turn a TWCC_ condition code into a string...

Parameters
[in]ccthe TWAIN Condition Code to translate
Returns
a string that represents the cc

Definition at line 1027 of file apps.cpp.


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