home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 9.ddi / TVSRC.ZIP / TPARAMTE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.0 KB  |  76 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       tparamte.cpp                              */
  3. /*                                                            */
  4. /* function(s)                                                */
  5. /*                  TParamText member functions               */
  6. /*------------------------------------------------------------*/
  7.  
  8. /*------------------------------------------------------------*/
  9. /*                                                            */
  10. /*    Turbo Vision -  Version 1.0                             */
  11. /*                                                            */
  12. /*                                                            */
  13. /*    Copyright (c) 1991 by Borland International             */
  14. /*    All Rights Reserved.                                    */
  15. /*                                                            */
  16. /*------------------------------------------------------------*/
  17.  
  18. #define Uses_TParamText
  19. #include <tv.h>
  20.  
  21. #if !defined( __STDIO_H )
  22. #include <Stdio.h>
  23. #endif  // __STDIO_H
  24.  
  25. TParamText::TParamText( const TRect& bounds,
  26.                         const char *aText,
  27.                         int aParamCount ) :
  28.     TStaticText(bounds, aText),
  29.     paramList( 0 ),
  30.     paramCount( aParamCount )
  31. {
  32. }
  33.  
  34. ushort TParamText::dataSize()
  35. {
  36.     return paramCount * sizeof(long);
  37. }
  38.  
  39. void TParamText::getText( char *s )
  40. {
  41.     if( text == 0 )
  42.         *s = EOS;
  43.     else
  44.         vsprintf( s, text, paramList );
  45. }
  46.  
  47. void TParamText::setData( void *rec )
  48. {
  49.     paramList = &rec;
  50. }
  51.  
  52. void TParamText::write( opstream& os )
  53. {
  54.     TStaticText::write( os );
  55.     os << paramCount;
  56. }
  57.  
  58. void *TParamText::read( ipstream& is )
  59. {
  60.     TStaticText::read( is );
  61.     is >> paramCount;
  62.     paramList = 0;
  63.     return this;
  64. }
  65.  
  66. TStreamable *TParamText::build()
  67. {
  68.     return new TParamText( streamableInit );
  69. }
  70.  
  71. TParamText::TParamText( StreamableInit ) : TStaticText( streamableInit )
  72. {
  73. }
  74.  
  75.  
  76.