home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IPROFILE.INL < prev    next >
Text File  |  1993-10-22  |  5KB  |  138 lines

  1. #ifndef _IPROFILE_INL_
  2. #define _IPROFILE_INL_ 0
  3. /*******************************************************************************
  4. * FILE NAME: iprofile.inl                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   This file contains the definition of the inline functions for the          *
  8. *   class(es) declared in iprofile.hpp.                                        *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or               *
  15. *   disclosure                                                                 *
  16. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  17. *                                                                              *
  18. *******************************************************************************/
  19. #ifndef _IPROFILE_
  20.   #undef  _IPROFILE_INL_
  21.   #define _IPROFILE_INL_ 1
  22.   #include <iprofile.hpp>
  23. #endif
  24.  
  25.  
  26. #if _IPROFILE_INL_
  27.   #define inline
  28. #endif
  29.  
  30. #ifndef _IEXCEPT_
  31.   #include<iexcept.hpp>
  32. #endif
  33. /*------------------------------------------------------------------------------
  34.   Return profile name
  35. ------------------------------------------------------------------------------*/
  36. inline IString IProfile::name ( ) const
  37. {
  38.    return profileName;
  39. }
  40.  
  41. /*------------------------------------------------------------------------------
  42.   Return the profile handler
  43. ------------------------------------------------------------------------------*/
  44. inline IProfileHandle IProfile::handle() const
  45. {
  46.   return hIni;
  47. }
  48.  
  49. /*------------------------------------------------------------------------------
  50.   Return default application name
  51. ------------------------------------------------------------------------------*/
  52. inline const IString& IProfile::defaultApplicationName ( ) const
  53. {
  54.    return defApplName;
  55. }
  56.  
  57. /*------------------------------------------------------------------------------
  58.   Sets the default application name
  59. ------------------------------------------------------------------------------*/
  60. inline IProfile& IProfile::setDefaultApplicationName ( const char *applName )
  61. {
  62.    defApplName = IString(applName);
  63.    return *this;
  64. }
  65.  
  66. /*------------------------------------------------------------------------------
  67.   Have the cursor point to the first element
  68. ------------------------------------------------------------------------------*/
  69. inline IBase::Boolean IProfile::Cursor :: setToFirst ()
  70. {
  71. this->pos = 1;
  72. // Valid if not off end...
  73. return this->pos < this->strCl.length();
  74. }
  75.  
  76. /*------------------------------------------------------------------------------
  77.   Have the cursor point to the next element
  78. ------------------------------------------------------------------------------*/
  79. inline IBase::Boolean IProfile::Cursor :: setToNext ()
  80. {
  81.   // Skip to next null...
  82.   this->pos = this->strCl.indexOf( '\0', this->pos );
  83.   // If not found, set position off end...
  84.   if ( this->pos == 0 )
  85.     this->pos == this->strCl.length() + 1;
  86.   // Else, point to next byte...
  87.   else
  88.     this->pos++;
  89.   // Valid if not off end...
  90.   return this->pos < this->strCl.length();
  91. }
  92.  
  93. /*------------------------------------------------------------------------------
  94.   Have the cursor point to the previous element
  95. ------------------------------------------------------------------------------*/
  96. inline IBase::Boolean IProfile::Cursor :: setToPrevious ()
  97. {
  98.   // If not at start, back up to previous null...
  99.   if ( this->pos > 1 && this->pos < this->strCl.length() )
  100.     this->pos = this->strCl.lastIndexOf( '\0', this->pos - 2 );
  101.   // Else, leave invalid...
  102.   else
  103.     this->pos = this->strCl.length();
  104.   // If not found, then we must now be at start...
  105.   if ( this->pos == 0 )
  106.     this->pos = 1;
  107.   // Else, position at byte past the null...
  108.   else
  109.     this->pos++; 
  110.  
  111.   // Valid if not off end...
  112.   return this->pos < this->strCl.length();
  113. }
  114.  
  115. /*------------------------------------------------------------------------------
  116.   Have the cursor point to the last element
  117. ------------------------------------------------------------------------------*/
  118. inline IBase::Boolean IProfile::Cursor :: setToLast ()
  119. {
  120.    // Position at last null (before the terminating one).
  121.    this->pos = this->strCl.lastIndexOf( '\0', this->strCl.length() - 2 );
  122.    // Advance to next byte.
  123.    this->pos++;
  124.  
  125.    // Valid if not off end...
  126.    return this->pos < this->strCl.length();
  127. }
  128.  
  129. /*------------------------------------------------------------------------------
  130.   Invalidate the cursor
  131. ------------------------------------------------------------------------------*/
  132. inline void IProfile::Cursor :: invalidate ()
  133. {
  134.   this->pos = this->strCl.length();
  135. }
  136.  
  137. #endif // _IPROFILE_INL_
  138.