L_AnnEnumerateTextTokenTable

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnEnumerateTextTokenTable(hAutomation, pfnCallback, pUserData)

HANNOBJECT hAutomation;

/* handle of the automation object */

ANNENUMTEXTTOKENTABLECALLBACK pfnCallback;

/* callback function for each entry in the text token table */

L_VOID *pUserData;

/* pointer to more parameters for the callback */

Lets you examine the contents of the annotation text token table.

Parameter

Description

hAutomation

Handle of the automation object.

pfnCallback

Callback function for processing each entry in the text token table. Use the function pointer as the value of this parameter.

 

L_AnnEnumerateTextTokenTable calls the pfnCallback callback function for each entry in the annotation text token table. The callback function must adhere to the function prototype described in the ANNENUMTEXTTOKENTABLECALLBACK Function.

pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure. If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to examine the contents of the annotation text token table. This function is used with the text annotation objects that support tokens, namely the following:

The pfnCallback is called for each token. Note that the tokens cannot be changed with this function. To modify the text token table, use one of the following functions:

L_AnnInsertTextTokenTable

L_AnnDeleteTextTokenTable

L_AnnClearTextTokenTable

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_AnnClearTextTokenTable, L_AnnDeleteTextTokenTable, L_AnnGetTextExpandTokens, L_AnnInsertTextTokenTable, L_AnnSetTextExpandTokens, ANNENUMTEXTTOKENTABLECALLBACK

Topics:

The Annotation Text Token Table

 

Annotation Functions (Document/Medical only): Text Properties

Example

// This sample enumerates all of the tokens in the text token table, 
// and displays the result
L_INT EXT_CALLBACK annTextTokenTableCallback(L_INT          nTextTokenCount,
                                             L_INT          nIndex,
                                             pANNTEXTTOKEN  pTextToken,
                                             L_VOID*        pUserData)
{
   L_TCHAR* pszMsg;
   L_TCHAR  szTemp[100];
   L_TCHAR* pszType;

   pszMsg = (L_TCHAR *)pUserData;

   if (nIndex == 0)
      wsprintf(pszMsg, TEXT("Total Tokens: %d\n"), nTextTokenCount);
   pszType = TEXT("Unknown");
   switch(pTextToken->nTokenType)
   {
   case ANNTOKEN_NONE:
      pszType = TEXT("ANNTOKEN_NONE");
      break;

   case ANNTOKEN_SEPARATOR:
      pszType = TEXT("ANNTOKEN_SEPARATOR");
      break;

   case ANNTOKEN_TEXT:
      pszType = TEXT("ANNTOKEN_TEXT");
      break;

   case ANNTOKEN_DATE_YYYY:
      pszType = TEXT("ANNTOKEN_DATE_YYYY");
      break;

   case ANNTOKEN_DATE_YY:
      pszType = TEXT("ANNTOKEN_DATE_YY");
      break;

   case ANNTOKEN_DATE_MM:
      pszType = TEXT("ANNTOKEN_DATE_MM");
      break;

   case ANNTOKEN_DATE_DD:
      pszType = TEXT("ANNTOKEN_DATE_DD");
      break;

   case ANNTOKEN_DATE_MONTH_NAME:
      pszType = TEXT("ANNTOKEN_DATE_MONTH_NAME");
      break;

   case ANNTOKEN_DATE_DAY_OF_WEEK:
      pszType = TEXT("ANNTOKEN_DATE_DAY_OF_WEEK");
      break;

   case ANNTOKEN_TIME_HH_12:
      pszType = TEXT("ANNTOKEN_TIME_HH_12");
      break;

   case ANNTOKEN_TIME_HH_24:
      pszType = TEXT("ANNTOKEN_TIME_HH_24");
      break;

   case ANNTOKEN_TIME_MM:
      pszType = TEXT("ANNTOKEN_TIME_MM");
      break;

   case ANNTOKEN_TIME_SS:
      pszType = TEXT("ANNTOKEN_TIME_SS");
      break;

   case ANNTOKEN_TIME_MILLISECONDS:
      pszType = TEXT("ANNTOKEN_TIME_MILLISECONDS");
      break;

   case ANNTOKEN_AM_PM:
      pszType = TEXT("ANNTOKEN_AM_PM");
      break;
   }

   wsprintf(szTemp, TEXT("[%d]#%c\t%s\t%s\t%s\n"),
      nIndex,
      pTextToken->cToken ? pTextToken->cToken : ' ',
      pTextToken->pszDesc  ? pTextToken->pszDesc : TEXT(""),
      pTextToken->pszTokenString  ? pTextToken->pszTokenString : TEXT(""),
      pszType);

   lstrcat(pszMsg, szTemp);
   return SUCCESS;
}


 L_INT AnnEnumeratTextTokenTableExample(HANNOBJECT hAutomation)
{
   L_INT nRet;
   L_TCHAR szMsg[1000];

   lstrcpy(szMsg, TEXT(""));
   nRet = L_AnnEnumerateTextTokenTable(hAutomation, annTextTokenTableCallback, szMsg);
   if(nRet != SUCCESS)
      return nRet;
   MessageBox(NULL, szMsg, TEXT("Text Token Table"), MB_OK);
   return SUCCESS;
}