home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / visbuild / rapsheet / cppwv23 / ialsrec.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  4.7 KB  |  112 lines

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