ImageGear for C and C++ on Windows v19.10 - Updated
IG_ISIS_tag_get_type
API Reference Guide > ISIS Component API Reference > ISIS Component Functions Reference > Tag Functions > IG_ISIS_tag_get_type

Get the type of a tag.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_ISIS_tag_get_type(
        HISISDRV hDriver,
        AT_MODE nTag,
        LPAT_MODE lpnType
);

Arguments:

Name Type Description
hDriver HISISDRV The handle to the driver.
nTag AT_MODE Specifies the tag for which to return the type.
lpnType LPAT_MODE Points to the address which will contain the type of wTag after this function completes. lpnType is filled in with one of the following values:
  • IG_ISIS_TAG_TYPE_STRING - The tag consists of an ASCII string.
  • IG_ISIS_TAG_TYPE_BYTE - The tag consists of one or more signed byte values.
  • IG_ISIS_TAG_TYPE_SHORT - The tag consists of one or more signed integer values.
  • IG_ISIS_TAG_TYPE_LONG - The tag consists of one or more signed long values.
  • IG_ISIS_TAG_TYPE_RATIONAL - The tag consists of one or more rational values.
The TIFF specification normally treats all values as unsigned. Note also that the types IG_ISIS_TAG_TYPE_BYTE, IG_ISIS_TAG_TYPE_SHORT, and IG_ISIS_TAG_TYPE_LONG are all accessed as longs in toolkit functions to reduce the total number of functions needed.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

This function does not process image pixels.

Remarks:

The IG_ISIS_tag_get_type function retrieves the type of the specified tag.

Use IG_ISIS_tag_get_type to determine the type of a tag before performing other functions such as IG_ISIS_tag_get_long, IG_ISIS_tag_get_long_default, etc., or IG_ISIS_choice_get_long, etc..

Example:

The following example returns a text string that indicates the type of a tag based on checking the tag inside a driver.

 
Copy Code
char FAR *GetTagText (HISISDRV hDriver, AT_MODE nTag)  {
  DWORD dwLength ;
  LONG lTemp ;
  WORD wTemp ;
  AT_ISIS_RAT    ratValue ;
  char   FAR *cpString ;
  if (IG_ISIS_tag_get_type (hDriver, nTag, &wTemp))
    return NULL ;
  switch (wTemp) {
    case IG_ISIS_TAG_TYPE_STRING:IG_ISIS_tag_get_length (hDriver, nTag, &dwLength) ;
      if (NULL == (cpString = (char FAR *) malloc((ulLength + 1))))
        return NULL ;IG_ISIS_tag_get_ascii (hDriver, nTag, dwLength, cpString) ;
      return cpString ;
    case IG_ISIS_TAG_TYPE_BYTE:
    case IG_ISIS_TAG_TYPE_SHORT:
    case IG_ISIS_TAG_TYPE_LONG:
      /* Return only first value. */
      if (NULL == (cpString = (char FAR *) malloc(20)))
        return NULL ;IG_ISIS_tag_get_long (hDriver, nTag, 0, &lTemp) ;
      sprintf (cpString, "%d", lTemp, 0) ;
      return cpString ;
    case IG_ISIS_TAG_TYPE_RATIONAL:
      /* Return only first value. */
      if (NULL == (cpString = (char FAR *) malloc(20)))
        return NULL ;IG_ISIS_tag_get_long (hDriver, nTag, 0, &ratValue) ;
      lTemp = (LONG) (ratValue.Num / ratValue.Denom) ;
sprintf (cpString, "%d", lTemp, 0) ;
return cpString ;
    default:
      return NULL ;
    }
  }

See Also

IG_ISIS_tag_get_ascii

IG_ISIS_tag_get_ascii_default

IG_ISIS_tag_get_length

IG_ISIS_tag_get_length_default

IG_ISIS_tag_get_long

IG_ISIS_tag_get_long_default

IG_ISIS_tag_get_rational

IG_ISIS_tag_get_rational_default

IG_ISIS_tag_set_ascii

IG_ISIS_tag_set_long

IG_ISIS_tag_set_rational