home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IPROFILE.INL
< prev
next >
Wrap
Text File
|
1993-10-22
|
5KB
|
138 lines
#ifndef _IPROFILE_INL_
#define _IPROFILE_INL_ 0
/*******************************************************************************
* FILE NAME: iprofile.inl *
* *
* DESCRIPTION: *
* This file contains the definition of the inline functions for the *
* class(es) declared in iprofile.hpp. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IPROFILE_
#undef _IPROFILE_INL_
#define _IPROFILE_INL_ 1
#include <iprofile.hpp>
#endif
#if _IPROFILE_INL_
#define inline
#endif
#ifndef _IEXCEPT_
#include<iexcept.hpp>
#endif
/*------------------------------------------------------------------------------
Return profile name
------------------------------------------------------------------------------*/
inline IString IProfile::name ( ) const
{
return profileName;
}
/*------------------------------------------------------------------------------
Return the profile handler
------------------------------------------------------------------------------*/
inline IProfileHandle IProfile::handle() const
{
return hIni;
}
/*------------------------------------------------------------------------------
Return default application name
------------------------------------------------------------------------------*/
inline const IString& IProfile::defaultApplicationName ( ) const
{
return defApplName;
}
/*------------------------------------------------------------------------------
Sets the default application name
------------------------------------------------------------------------------*/
inline IProfile& IProfile::setDefaultApplicationName ( const char *applName )
{
defApplName = IString(applName);
return *this;
}
/*------------------------------------------------------------------------------
Have the cursor point to the first element
------------------------------------------------------------------------------*/
inline IBase::Boolean IProfile::Cursor :: setToFirst ()
{
this->pos = 1;
// Valid if not off end...
return this->pos < this->strCl.length();
}
/*------------------------------------------------------------------------------
Have the cursor point to the next element
------------------------------------------------------------------------------*/
inline IBase::Boolean IProfile::Cursor :: setToNext ()
{
// Skip to next null...
this->pos = this->strCl.indexOf( '\0', this->pos );
// If not found, set position off end...
if ( this->pos == 0 )
this->pos == this->strCl.length() + 1;
// Else, point to next byte...
else
this->pos++;
// Valid if not off end...
return this->pos < this->strCl.length();
}
/*------------------------------------------------------------------------------
Have the cursor point to the previous element
------------------------------------------------------------------------------*/
inline IBase::Boolean IProfile::Cursor :: setToPrevious ()
{
// If not at start, back up to previous null...
if ( this->pos > 1 && this->pos < this->strCl.length() )
this->pos = this->strCl.lastIndexOf( '\0', this->pos - 2 );
// Else, leave invalid...
else
this->pos = this->strCl.length();
// If not found, then we must now be at start...
if ( this->pos == 0 )
this->pos = 1;
// Else, position at byte past the null...
else
this->pos++;
// Valid if not off end...
return this->pos < this->strCl.length();
}
/*------------------------------------------------------------------------------
Have the cursor point to the last element
------------------------------------------------------------------------------*/
inline IBase::Boolean IProfile::Cursor :: setToLast ()
{
// Position at last null (before the terminating one).
this->pos = this->strCl.lastIndexOf( '\0', this->strCl.length() - 2 );
// Advance to next byte.
this->pos++;
// Valid if not off end...
return this->pos < this->strCl.length();
}
/*------------------------------------------------------------------------------
Invalidate the cursor
------------------------------------------------------------------------------*/
inline void IProfile::Cursor :: invalidate ()
{
this->pos = this->strCl.length();
}
#endif // _IPROFILE_INL_