home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / RAPSHEET / CPPOV23 / IALSREC.CPP < prev    next >
Text File  |  1995-05-14  |  4KB  |  106 lines

  1. //****************************************************************************
  2. // IAliasRecord Class - C++ Source File (ialsrec.cpp)                        *
  3. //                                                                           *
  4. // COPYRIGHT: Copyright (C) International Business Machines Corp., 1994,1995 *
  5. //                                                                           *
  6. // DISCLAIMER OF WARRANTIES:                                                 *
  7. //   The following [enclosed] code is sample code created by IBM             *
  8. //   Corporation.  This sample code is not part of any standard IBM product  *
  9. //   and is provided to you solely for the purpose of assisting you in the   *
  10. //   development of your applications.  The code is provided "AS IS",        *
  11. //   without warranty of any kind.  IBM shall not be liable for any damages  *
  12. //   arising out of your use of the sample code, even if they have been      *
  13. //   advised of the possibility of such damages.                             *
  14. //****************************************************************************
  15. //NOTE: WE RECOMMEND USING A FIXED-SPACE FONT TO LOOK AT THE SOURCE.
  16. //
  17.  
  18. #include "ialsrec.hpp"               //IAliasRecord header
  19. #include <rap.h>
  20.  
  21. /*******************************************************************
  22.  * Manager Member Functions 
  23.  *******************************************************************/
  24. IAliasRecord :: IAliasRecord() :
  25.                      IRecord (),
  26.                      dMySize(ALIAS_NAME_LEN)
  27. {
  28.    dParentSize = size();
  29.    setSize( dParentSize + dMySize );  //pad with '\x00'
  30. }
  31.  
  32. IAliasRecord :: IAliasRecord ( const IString & stringData ) :
  33.                      IRecord(),
  34.                      dMySize(ALIAS_NAME_LEN)
  35.  
  36. {
  37.    dParentSize = size();
  38.    *this = stringData;
  39.    setSize( dParentSize + dMySize );  //truncate or pad as appropriate
  40. }
  41.  
  42. IAliasRecord :: IAliasRecord ( const IAliasRecord & aRecord ) :
  43.                      IRecord(),
  44.                      dMySize(ALIAS_NAME_LEN)
  45. {
  46.    dParentSize = size();
  47.    *this = aRecord;
  48.   /*------------------------------------------------------------------
  49.    * NOTE:  this record would have gotten set with the correct size
  50.    *        if had called the IRecord (aRecord) constructor, but
  51.    *        need to determine what dParentSize is (the assignment
  52.    *        operators need this info).
  53.    *-----------------------------------------------------------------*/
  54. }
  55.  
  56. IAliasRecord :: ~IAliasRecord()
  57. {
  58. }
  59.  
  60. /*******************************************************************
  61.  * Access Member Functions 
  62.  *******************************************************************/
  63. /*------------------------------------------------------------------
  64.  * name
  65.  *-----------------------------------------------------------------*/
  66. IString IAliasRecord :: name () const
  67. {
  68.    IString buffer;
  69.    return field(buffer, 1, ALIAS_NAME_LEN);
  70. }
  71.  
  72. IAliasRecord & IAliasRecord :: setName
  73.   (const IString & iName)
  74. {
  75.    setField(iName, 1, ALIAS_NAME_LEN);
  76.    return *this;
  77. }
  78.  
  79. /*******************************************************************
  80.  * Implementor Member Functions (not Part Actions)
  81.  *******************************************************************/
  82. /*------------------------------------------------------------------------------
  83. | Function Name: IAliasRecord :: operator =
  84. |
  85. | Implementation:
  86. |   Replace our data with the source IAliasRecord data.
  87. ------------------------------------------------------------------------------*/
  88. IAliasRecord & IAliasRecord :: operator = ( const IAliasRecord & aRecord )
  89. {
  90.   IRecord::operator=(aRecord);
  91.   return( *this );
  92. }
  93.  
  94. /*------------------------------------------------------------------------------
  95. | Function Name: IAliasRecord :: operator =
  96. |
  97. | Implementation:
  98. |   Replace our data with the source IString data.
  99. ------------------------------------------------------------------------------*/
  100. IAliasRecord & IAliasRecord :: operator = ( const IString & aString )
  101. {
  102.   IRecord::operator=(aString);
  103.   setSize (dParentSize + dMySize);
  104.   return( *this );
  105. }
  106.