home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / iofilter.cxx < prev    next >
C/C++ Source or Header  |  1995-04-04  |  2KB  |  81 lines

  1.  
  2.  
  3.  
  4.  
  5. /*
  6.  *
  7.  *          Copyright (C) 1994, M. A. Sridhar
  8.  *  
  9.  *
  10.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  11.  *     to copy, modify or distribute this software  as you see fit,
  12.  *     and to use  it  for  any  purpose, provided   this copyright
  13.  *     notice and the following   disclaimer are included  with all
  14.  *     copies.
  15.  *
  16.  *                        DISCLAIMER
  17.  *
  18.  *     The author makes no warranties, either expressed or implied,
  19.  *     with respect  to  this  software, its  quality, performance,
  20.  *     merchantability, or fitness for any particular purpose. This
  21.  *     software is distributed  AS IS.  The  user of this  software
  22.  *     assumes all risks  as to its quality  and performance. In no
  23.  *     event shall the author be liable for any direct, indirect or
  24.  *     consequential damages, even if the  author has been  advised
  25.  *     as to the possibility of such damages.
  26.  *
  27.  */
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #ifdef __GNUC__
  34. #pragma implementation
  35. #endif
  36.  
  37.  
  38.  
  39. #include "base/iofilter.h"
  40. #include "base/stream.h"
  41.  
  42.  
  43. CL_ObjectPtr CL_ObjectIOFilter::RestoreFrom (const CL_Stream& s)
  44. {
  45.     CL_ObjectPtr p;
  46.     return s.Read (p) ? p : (CL_ObjectPtr) NULL;
  47. }
  48.  
  49. bool CL_ObjectIOFilter::RestoreFrom (const CL_Stream& s, CL_Object& o)
  50. {
  51.     return s.Read (o);
  52. }
  53.  
  54. bool       CL_ObjectIOFilter::SaveTo (CL_Stream& s, const CL_Object& o) const
  55. {
  56.     return s.Write (o);
  57. }
  58.  
  59.  
  60. bool   CL_ObjectIOFilter::SaveTo (CL_Stream& s, CL_ObjectPtr o) const
  61. {
  62.     return s.Write (o);
  63. }
  64.  
  65.  
  66.  
  67. template <class Base>
  68. CL_Object* CL_IOFilter<Base>::RestoreFrom (const CL_Stream& s)
  69. {
  70.     Base* p = new Base; return p && p->ReadFrom (s);
  71. }
  72.  
  73.  
  74. template <class Base>
  75. bool CL_IOFilter<Base>::RestoreFrom (const CL_Stream& s, CL_Object& o)
  76. {
  77.     return p.ReadFrom (s);
  78. }
  79.  
  80.  
  81.