home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / idbcsbuf.inl < prev    next >
Encoding:
Text File  |  1996-02-22  |  2.3 KB  |  77 lines

  1. #ifndef _IDBCSBUF_INL_
  2. #define _IDBCSBUF_INL_ 0
  3. /*******************************************************************************
  4. * FILE NAME: idbcsbuf.inl                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the definition of the inline functions for the          *
  8. *   classes declared in idbcsbuf.hpp.                                          *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #ifndef _IDBCSBUF_
  19.   #undef  _IDBCSBUF_INL_
  20.   #define _IDBCSBUF_INL_ 1
  21.   #include <idbcsbuf.hpp>
  22. #endif
  23.  
  24. #if _IDBCSBUF_INL_
  25.   #include <istring.hpp>
  26.   #define inline
  27. #endif
  28.  
  29. inline size_t IDBCSBuffer :: charLength ( char const* p )
  30.   {
  31.  
  32. #ifdef IC_NLS
  33.   if (IString::isInternationalized())
  34.   {
  35.   if ( *p == 0 )
  36.      return 1;
  37.   else
  38.   {
  39.    int temp = 0;
  40.    return ( ( (temp = mblen( p, MB_LEN_MAX ) ) > 0) ? temp : 1 );
  41.   }
  42.   }
  43.   else
  44.   {
  45. #endif
  46.   return (IBuffer::isDBCSLead(*p) ? 2 : 1);
  47.   if ( *p == 0 )
  48.      return 1;
  49.   else
  50.   {
  51.    int temp = 0;
  52.    return ( ( (temp = mblen( p, MB_LEN_MAX ) ) > 0) ? temp : 1 );
  53.   }
  54.  
  55. #ifdef IC_NLS
  56.   }
  57. #endif
  58.  
  59.   }
  60.  
  61. inline size_t IDBCSBuffer :: charLength ( unsigned pos ) const
  62.   {
  63.   return charLength ( contents() + pos - 1 );
  64.   }
  65.  
  66. inline size_t IDBCSBuffer :: maxCharLength ( )
  67.   {
  68.   return MB_CUR_MAX;
  69.   }
  70.  
  71. inline IBase::Boolean IDBCSBuffer :: isSBC ( char const* p )
  72.   {
  73.   return ( charLength ( p ) == 1 );
  74.   }
  75.  
  76. #endif // _IDBCSBUF_INL_
  77.